Max inside For-loop vs Max with Map
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var a = [];
var s = "";
var max;
for (var i = 0; i < 10000; ++i) {
a.push(s);
s += "a";
}
var b = a.map(function (si) { return si.length; });
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Max inside For-loop |
|
pending… |
Max with Map |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments