Array Pushing: Object Function Wrapper Versus Object
JavaScript performance comparison
Info
Comparison at how fast wrapping an object in a function (for code reduction) is when pushing new arrays into it versus just using a plain object.
Preparation code
<script>
Benchmark.prototype.setup = function() {
var tests = [];
function test(a, b, c, i) {
i = i || {};
i.a = a;
i.b = b;
i.c = c;
return i;
}
var tests2 = [];
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Object Function Wrapper |
|
pending… |
Object |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments