belt loops
JavaScript performance comparison
Info
this title is just too clever by, like, half.
Preparation code
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.3/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.3/lodash.min.js"></script>
<script>
var lodash = _.noConflict();
</script>
<script src="http://sjhcockrell.s3.amazonaws.com/downloads/belt.js"></script>
<script>
Benchmark.prototype.setup = function() {
var a = [],
b = [];
for (var i = 0; i < 20; i+=1) {
a.push(i);
}
for (var i = 0; i < 1000; i+=1 ) {
b.push(i);
}
function MathIt(n) {
return n % 2;
}
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
B.forIndex - a |
|
pending… |
B.forEach - a |
|
pending… |
Underscore.forEach - a |
|
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 John Cockrell
- Revision 2: published by John Cockrell
- Revision 3: published by John Cockrell
- Revision 4: published by John Cockrell
- Revision 5: published by John Cockrell
- Revision 6: published by John Cockrell
- Revision 7: published
0 comments