Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
jQuery.each() vs Array.prototype.forEach()
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15
Browser:
Safari 17
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
jQuery.each
0.0 Ops/sec
Array.prototype.forEach
10529261.0 Ops/sec
traditional for loop
824169.6 Ops/sec
Script Preparation code:
var arr = ['torus', 'gospel', 'bacon', 'moist', 'lodge', 'flip', 'ev', 'usual', 'glans', 'lanka', 'ames', 'stoic', 'weco', 'buff', 'naacp', 'mercy', 'stork', 'rq', 'mace', '37', 'rung', 'shod', 'snap', 'pr', 'horus', 'lane', 'safe', 'tie', 'yeasty', 'topple', 'grist', 'coed', 'sled', 'bosom', 'packet', 'xn', 'bunch', 'rowdy', 'jo', 'prone', 'styli', 'warmth', 'jimmy', 'launch', 'aspire', 'roil', 'ohm', 'doff', 'slice', 'dream', 'roger', 'theme', 'lz', 'minus', 'lusty', '35th', 'acuity', 'eli', 'spool', 'pivot'];
Tests:
jQuery.each
var temp; $.each(arr, function(index, item) { temp = item; });
Array.prototype.forEach
var temp; arr.forEach(function(item) { temp = item; });
traditional for loop
var temp; for (var i = 0, len = arr.length; i !== len; ++i) { temp = arr[i]; }