underscore_mod-no-native
JavaScript performance comparison
Info
For a more thorough suite of benchmarks, visit http://lodash.com/benchmarks.
Preparation code
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.min.js"></script>
<script>
var lodash = _.noConflict();
</script>
<script>
Benchmark.prototype.setup = function() {
var numbers = [];
var object = {};
for (var i = 0; i < 20; i++) {
numbers[i] = i;
object['key' + i] = i;
}
var objects = _.map(numbers, function(n) { return { 'num': n }; });
var randomized = _.sortBy(numbers, function() { return Math.random(); });
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
each |
|
pending… |
each lodash |
|
pending… |
each object |
|
pending… |
each object lodash |
|
pending… |
keys |
|
pending… |
keys lodash |
|
pending… |
map |
|
pending… |
map lodash |
|
pending… |
pluck |
|
pending… |
pluck lodash |
|
pending… |
values |
|
pending… |
values lodash |
|
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-David Dalton and last updated
- Revision 2: published by John-David Dalton
- Revision 3: published
1 comment
See rev 2 for comparing
lodash.mobileperf (it's faster in Safari)