The amazing JavaScript

Javascript, HTML5 and the browser in all its incarnations are quickly becoming the new amazing way of developing applications for the “plain and simple end-user”.

On the MacBook Pro Javascript was 44% slower than C (Java only 1.5%). The Javascript Nitro VM on my iPhone 4S was 99% slower than C. On the Nexus 7 there’s once again the same image: Java is 106% slower than C, Javascript only 43%. Amazing. For simple numeric benchmarks the performance of Javascript is simply astonishing. On the MacBook Pro Javascript is incredibly close to the performance of C and Java. On the iPhone Javascript was within a range of factor 2.1. For me it was very surprising to see V8 on Android being able to beat Java on the Davlik VM by a large margin.Fine print: Slower and faster usually cause headaches in benchmarks (There a nice paper about that http://hal.inria.fr/docs/00/73/92/37/PDF/percentfaster-techreport.pdf). I sticked with the elapsed time, such that e.g. 42% slower means that the factor of the durations was 1.42. On the MacBook Pro C was compiled with clang using -O3 -fomit-frame-pointer -march=native -mfpmath=sse -msse3 for x64. Java was Oracle Hotspot 1.8.0-ea-b87 on 64 bit (thus C2 aka Server Hotspot). Chrome was 28.0.1493.0, but the 32 bit version. I tried to compile V8 myself, but both the x86 and x64 custom built V8 were significantly slower than Chrome so I stick with Chrome. On the iPhone I used a release configuration using clang with (among others) -O3 -arch armv7 The Google Nexus 7 runs Android 4.2.2, Chrome 26.0.1410.58. C was compiled with -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp -O3.

Sorgente: C, Java and Javascript numeric benchmark and a big surprise | Stefan Krause.blog()

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.