Function In Loop
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
function rand(from, to) {
from = from || 0;
to = to || 255;
return Math.floor(Math.random() * (to - from + 1) + from);
}
var arr = [];
for (var i = 0; i < 10; i++) {
arr.push([rand(), rand(), rand()]);
}
function arrtostring(a) {
return a.join();
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Use Predefined Function |
|
pending… |
Create Function |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments