Zero filling
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
function zeroFill(len) {
var zero = [];
while (--len) {
zero.push(0);
}
return zero;
}
function zeroFill2(len) {
var zero = new Array(len);
while (--len) {
zero[len] = 0;
}
return zero;
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
small-1 |
|
pending… |
small-2 |
|
pending… |
large-1 |
|
pending… |
large-2 |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments