📜 ⬆️ ⬇️

Performance comparison of Javascript engines with native Linux application

Today there are many browsers and they all somehow fight each other for the market. The main players are: Internet Explorer, Mozilla Firefox, Google Chrome, Safari. And today they are copying each other’s appearance (everyone is trying to be like Google Chrome) and everyone is praising who is the best for HTML 5, though the main thing is that they praise it - it is a canvas tag.

So it turns out that they are all almost the same, but somehow they need to stand out to be the best? And here there is something else that they always praise - the speed of work. 10 years ago, under the speed of the browser meant the speed of loading the page (for example, part of the army of Opera fans just because of this feature). In general, the work of Javascript is important for today, the implementation of which boasts every browser. They even give Javascript engines their names and this becomes their regular trademark. That's exactly the same speed of Javascript and is today the main advantage of one or another browser.

By writing this article, I came after reading " Ten things that you did not expect from HTML / Javascript ." And I was so surprised that there was even drawing 3D graphics on JavaScript that I wanted to take some performance measurements myself.
I decided to compare this speed and did a little research. I wrote a search program for n prime numbers: not the best task for computing performance, but a lot of different elements of the language (floating-point numbers, containers, cycles, branching) participate in it and launched it on different platforms (browsers, JVM, Linux) . Well, actually the result will be presented in the form of coefficients:
  1. Linux Native Application (Ubuntu, g ++ 4.4) - 1
  2. Java Application (Ubuntu, Oracle Java 6.20) - 1.53
  3. Firefox 4b6pre (Ubuntu) - 1.62
  4. Internet Explorer 9 beta (Windows) - 1.87
  5. Google Chrome 6.0.472 (Windows, Ubuntu) - 2.09
  6. Opera 10.64 (Ubuntu) - 2.93
  7. Firefox 4b5 (Windows) - 3.12
  8. Safari 5.0.3 (Windows) - 4.37

By passing, I checked Firefox 3.6 (Ubuntu, Windows), Konqueror 4.4.2 (Ubuntu) and Internet Explorer 8, but their performance was lower by an order of magnitude. There is no completeness of all possible actual systems, but only some of them that were convenient for me to run. Again, some conclusions can be drawn from this data.

Operating systems used: Ubuntu 10.04 x64, Windows 7 Home Premium x64
Source code of programs: in JavaScript , in C ++ , in Java

So, it turned out that the execution of Javascript, thanks to complex JIT-compilation mechanisms on modern browsers, gives a performance close to Java-based or lower-level applications.

Source: https://habr.com/ru/post/105199/

All Articles