3 ms·
Unusable micro-benchmark. The JIT can compile everything away. From the code in http://ernestdelgado.com/js/main.js http://ernestdelgado.com/js/main.js fun
by silvestrov 17y ago
Unusable micro-benchmark. The JIT can compile everything away. From the code in http://ernestdelgado.com/js/main.js http://ernestdelgado.com/js/main.js
function doubletilda() {
~~0.12341234;
~~0.2;
~~-3.1234;
~~100000.23;
~~2.12341234123412341324;
~~100.0000000000000000001;
}
function pipe() {
0.12341234|0.12341234;
0.2|0.2;
-3.1234|-3.1234;
100000.23|100000.23;
2.12341234123412341324|2.12341234123412341324;
100.0000000000000000001|100.0000000000000000001;
}
The JIT should be able to optimize the function bodies away.
And the loop is:
// var fn = doubletilda;
for (var n = 0, t = 0; t < 1000; n++) {
fn();
t = new Date() - start;
}
So he's basically just testing creating objects and GC.