3 ms·
I've been surprised how fast javascript can go - faster than C here. They did good work on that JIT. Playing around I see: for (i=1;i<1e9;i++) {} runs about 1
by tim333 9y ago
I've been surprised how fast javascript can go - faster than C here. They did good work on that JIT.
Playing around I see: for (i=1;i<1e9;i++) {}
runs about 10x faster than: for (i=1.5;i<1e9;i++) {}
presumably because it complies to integer code for the first (using Chrome)
- acqq 9y ago> faster than C here It's "faster than C which swims with the tied hands": when you allow all optimizations C is "infinitely fast" in this given case, as the loops aren't even executed but the results precomputed in the compile time. Can you give your numbers for Chrome? Typically it was slower than Firefox for such Javascript since a while. Note that to make comparison fair you have to use a while loop in a while loop and to print the resulting counters after both loops finish.