pointer-alternative
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
data = {};
data[0] = {};
data[1] = "Lorem ipsum dolor sedet. Quem aldor edit iacem, qui et non coniunctivus. Ador videt aves. In hortum sedet. 'Ave, aves' dixit.";
data[2] = 2;
for (i=0; i<50; i++) {
data[0][i] = 100 - i;
data[1] += data[1];
data[2] *= (i+1);
}
function testA(obj, count) {
if (count > 0) {
testA(obj, count-1);
} else {
var testVar = obj.toString();
}
}
function testB(id, count) {
if (count > 0) {
testB(id, count-1);
} else {
var testVar = data[id].toString();
}
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
No pointers |
|
pending… |
With alternative pointers |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments