Comparison of Javascript engine performance with native Linux application
Today, there are many browsers and they all somehow struggle with each other for the sake of the market. Key players: Internet Explorer, Mozilla Firefox, Google Chrome, Safari. And today they copy each other’s appearance (everyone is trying to resemble Google Chrome) and everyone praises which of them better matches HTML 5, although the main thing is that they praise it - it's the canvas tag.
So it turns out that they are all almost the same, but somehow, after all, they need to stand out in order to be the best? And here is something else that they always praise - speed. About 10 years ago, the speed of the browser meant the speed of loading the page (for example, part of the army of Opera fans is just because of this opportunity). In general, Javascript is important today, the implementation of which every browser boasts. They even give their Javascript engines their names and this becomes their next brand. That is the very speed of Javascript and is today the main advantage of one or another browser.
I came to this article after reading " Ten Things You Didn't Expect From HTML / Javascript". And I was so much surprised that there was even drawing 3D-graphics in JavaScript that I wanted to conduct some performance measurements on my own.
I decided to just compare this speed and did a little research. I wrote a program for finding n prime numbers: not the best task for calculating performance, but it involves a lot of different language elements (floating-point numbers, containers, loops, branches) and launched it on various platforms (browsers, JVM, Linux) .Well, the actual result will be presented in the form of ffitsientov:
Among other things, I tested Firefox 3.6 (Ubuntu, Windows), Konqueror 4.4.2 (Ubuntu) and Internet Explorer 8, but their performance was an order of magnitude lower. There is no completeness of all possible relevant systems, but only some of them that were convenient for me to run. Again, some conclusions can be drawn from this data.
Used operating systems: Ubuntu 10.04 x64, Windows 7 Home Premium x64
Source code for programs: in JavaScript , in C ++ , in Java
So, it turned out that Javascript execution, thanks to the complex JIT compilation mechanisms on modern browsers, produces productivity similar to Java - applications or applications of a lower level.
So it turns out that they are all almost the same, but somehow, after all, they need to stand out in order to be the best? And here is something else that they always praise - speed. About 10 years ago, the speed of the browser meant the speed of loading the page (for example, part of the army of Opera fans is just because of this opportunity). In general, Javascript is important today, the implementation of which every browser boasts. They even give their Javascript engines their names and this becomes their next brand. That is the very speed of Javascript and is today the main advantage of one or another browser.
I came to this article after reading " Ten Things You Didn't Expect From HTML / Javascript". And I was so much surprised that there was even drawing 3D-graphics in JavaScript that I wanted to conduct some performance measurements on my own.
I decided to just compare this speed and did a little research. I wrote a program for finding n prime numbers: not the best task for calculating performance, but it involves a lot of different language elements (floating-point numbers, containers, loops, branches) and launched it on various platforms (browsers, JVM, Linux) .Well, the actual result will be presented in the form of ffitsientov:
- Linux Native Application (Ubuntu, g ++ 4.4) - 1
- Java Application (Ubuntu, Oracle Java 6.20) - 1.53
- Firefox 4b6pre (Ubuntu) - 1.62
- Internet Explorer 9 beta (Windows) - 1.87
- Google Chrome 6.0.472 (Windows, Ubuntu) - 2.09
- Opera 10.64 (Ubuntu) - 2.93
- Firefox 4b5 (Windows) - 3.12
- Safari 5.0.3 (Windows) - 4.37
Among other things, I tested Firefox 3.6 (Ubuntu, Windows), Konqueror 4.4.2 (Ubuntu) and Internet Explorer 8, but their performance was an order of magnitude lower. There is no completeness of all possible relevant systems, but only some of them that were convenient for me to run. Again, some conclusions can be drawn from this data.
Used operating systems: Ubuntu 10.04 x64, Windows 7 Home Premium x64
Source code for programs: in JavaScript , in C ++ , in Java
So, it turned out that Javascript execution, thanks to the complex JIT compilation mechanisms on modern browsers, produces productivity similar to Java - applications or applications of a lower level.