4 ms·
Not really, things like branch prediction and JIT optimizations will kick in pretty fast. This is why these benchmarks on jsperf suck - the code gets a differen
by inglor 13y ago
Not really, things like branch prediction and JIT optimizations will kick in pretty fast. This is why these benchmarks on jsperf suck - the code gets a different 'fresh' version every time and jits (like crankshaft in v8 ) don't get to work.
Effectively, you're checking 'the performance of interperted JavaScript' most the the time.
- goldenkey 13y agoI bet my bottom dollar that branch prediction is not going to magic away that index dependent if statement in a language like JS, even with Crankshaft in full effect.
- inglor 13y agoHere, it's within 20% of the performance. Definitely not n vs 2n http://jsperf.com/oh-look-branches http://jsperf.com/oh-look-branches