Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
lodash.each vs Object.forEach vs jQuery each vs layui each
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0
Browser:
Firefox 124
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
lodash.each
235879.8 Ops/sec
native
157620.2 Ops/sec
for loop
24915.2 Ops/sec
jQuery each
296077.2 Ops/sec
layui each
60721.3 Ops/sec
HTML Preparation code:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js"></script> <script src="https://cdn.bootcdn.net/ajax/libs/layui/2.6.8/layui.min.js"></script>
Script Preparation code:
// Populate the base array var arr = []; for (var i = 0; i < 1000; i++) { arr[i] = i; } function fn(a) { return a * 2 * 5; }
Tests:
lodash.each
_.forEach(arr,fn)
native
arr.forEach(fn)
for loop
for(i=0;i<arr.length;i++) fn(arr[i]);
jQuery each
$.each(arr,fn);
layui each
layui.each(arr,function(i,e){fn(e)})