for foreach
JavaScript performance comparison
Preparation code
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.3/lodash.min.js"></script>
<script>
var media = [];
var types = [123, 666, 999, 'test', 'hello', 'bar', 0];
for (var i = 0; i < 100; i++) {
media[i] = {
name: i,
type: types
};
}
media[50].type = types.concat('foo');
</script>
<script>
Benchmark.prototype.setup = function() {
var type = 'foo';
var result;
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
for |
|
pending… |
lodash find |
|
pending… |
lodash forEach |
|
pending… |
while |
|
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 OSM Buildings and last updated
- Revision 2: published by OSM Buildings
0 comments