speedr.js vs normal object iteration
JavaScript performance comparison
Info
Compares speedr.js iterators to normal object iteration.
All functions are designed so that they end up with two local variables, k and v, which correspond to key, value pairs.
Preparation code
<script src="https://raw.github.com/genericdave/speedr.js/master/speedr.js">
</script>
<script>
Benchmark.prototype.setup = function() {
var obj = {};
var map = new speedr.Map();
for (i = 0; i <= 1000; i++) {
iS = i.toString();
obj[iS] = iS;
map.set([iS, iS]);
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Normal object for loop |
|
pending… |
speedr.js each |
|
pending… |
speedr.js iter |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published by genericdave
- Revision 2: published by genericdave
- Revision 4: published
- Revision 5: published by Alex
0 comments