Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object array of arrays for vs foreach vs for..in vs for..of
Compare loop performance
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser:
Chrome 136
Operating system:
Linux
Device Platform:
Desktop
Date tested:
10 months ago
Test name
Executions per second
for
8775063.0 Ops/sec
foreach
8901411.0 Ops/sec
for in
3619624.2 Ops/sec
for..of
8992167.0 Ops/sec
Script Preparation code:
let name; let email; var array = new Array([ { "message": "Hello, Jovany! Your order number is: #93", "phoneNumber": "722.276.0627 x55969", "phoneVariation": "+90 360 152 10 96", "status": "active", "name": { "first": "Karen", "middle": "Ryan", "last": "Bruen" }, "username": "Karen-Bruen", "password": "WrUVP9x7rs4GZxI", "emails": [ "Queenie49@example.com", "Rosalind38@example.com" ], "location": { "street": "724 Low Road", "city": "Samarafield", "state": "New Hampshire", "country": "Bosnia and Herzegovina", "zip": "07064", "coordinates": { "latitude": "41.736", "longitude": "83.4531" } }, "website": "https://numb-assessment.net", "domain": "flustered-doughnut.name", "job": { "title": "National Branding Facilitator", "descriptor": "Chief", "area": "Security", "type": "Representative", "company": "Rosenbaum Inc" }, "creditCard": { "number": "502023253943260581", "cvv": "381", "issuer": "mastercard" }, "uuid": "d217f62b-7a54-4f6d-864b-f77b78d75aa4", "objectId": "6858f531739488bf7794df30" }, { "message": "Hello, Angus! Your order number is: #31", "phoneNumber": "1-496-372-1828 x871", "phoneVariation": "+90 334 665 10 50", "status": "disabled", "name": { "first": "Reva", "middle": "Robin", "last": "Koss" }, "username": "Reva-Koss", "password": "KBWWBWbMw4UHwPK", "emails": [ "Corrine77@example.com", "Sabryna16@gmail.com" ], "location": { "street": "47330 Otha Trafficway", "city": "Fort Polly", "state": "Maine", "country": "Georgia", "zip": "57343", "coordinates": { "latitude": "-25.6989", "longitude": "-142.125" } }, "website": "https://majestic-woodshed.com/", "domain": "distinct-reorganisation.info", "job": { "title": "Product Branding Director", "descriptor": "Customer", "area": "Functionality", "type": "Administrator", "company": "Koelpin, Boehm and Fay" }, "creditCard": { "number": "5482-2957-1441-2790", "cvv": "304", "issuer": "jcb" }, "uuid": "ca68f026-c5df-4e83-9153-67ecc574fac8", "objectId": "6858f531739488bf7794df31" }, { "message": "Hello, Verna! Your order number is: #72", "phoneNumber": "(680) 957-3425", "phoneVariation": "+90 392 882 10 18", "status": "disabled", "name": { "first": "Carissa", "middle": "Riley", "last": "Erdman" }, "username": "Carissa-Erdman", "password": "HzlVsoYOuKrxOUJ", "emails": [ "Jacinto.Lehner@example.com", "Cassandra_Davis@example.com" ], "location": { "street": "6788 Wisozk Expressway", "city": "Clintville", "state": "Minnesota", "country": "Lao People's Democratic Republic", "zip": "51096-7470", "coordinates": { "latitude": "52.4872", "longitude": "55.4912" } }, "website": "https://uncomfortable-mocha.net/", "domain": "far-off-storage.biz", "job": { "title": "International Solutions Executive", "descriptor": "Forward", "area": "Functionality", "type": "Engineer", "company": "Hahn, DuBuque and Jacobs" }, "creditCard": { "number": "3663-436889-3321", "cvv": "017", "issuer": "maestro" }, "uuid": "56656172-4796-4cd2-8797-1dbef2d319c7", "objectId": "6858f531739488bf7794df32" }, { "message": "Hello, Lamont! Your order number is: #37", "phoneNumber": "836-562-5512 x03820", "phoneVariation": "+90 331 449 10 48", "status": "disabled", "name": { "first": "Reynold", "middle": "Anderson", "last": "Simonis" }, "username": "Reynold-Simonis", "password": "zBF8OrEmwVrSGmU", "emails": [ "Tanya_Koss96@gmail.com", "Kariane_Lind@gmail.com" ], "location": { "street": "896 Woodlands Road", "city": "Fort Dax", "state": "Mississippi", "country": "Slovakia", "zip": "49770", "coordinates": { "latitude": "-21.3388", "longitude": "-106.8874" } }, "website": "https://afraid-strobe.com", "domain": "content-feather.info", "job": { "title": "Global Optimization Planner", "descriptor": "Central", "area": "Group", "type": "Technician", "company": "Crona, Kuhn and Lehner" }, "creditCard": { "number": "3569-2993-1027-1932", "cvv": "374", "issuer": "jcb" }, "uuid": "0aef71df-5cc5-4beb-978e-b831b78e8d05", "objectId": "6858f531739488bf7794df33" }, { "message": "Hello, Rodolfo! Your order number is: #59", "phoneNumber": "(428) 304-2202", "phoneVariation": "+90 398 320 10 97", "status": "active", "name": { "first": "Daisha", "middle": "Charlie", "last": "Denesik" }, "username": "Daisha-Denesik", "password": "VI8D54BNvqOqCMM", "emails": [ "Julia42@gmail.com", "Adalberto88@example.com" ], "location": { "street": "436 Predovic Terrace", "city": "Fort Demarcoport", "state": "Virginia", "country": "France", "zip": "33771", "coordinates": { "latitude": "33.0057", "longitude": "42.4995" } }, "website": "https://terrible-arrow.info/", "domain": "burdensome-section.name", "job": { "title": "Principal Configuration Engineer", "descriptor": "Central", "area": "Group", "type": "Engineer", "company": "Wolff LLC" }, "creditCard": { "number": "2514-7382-0147-3253", "cvv": "379", "issuer": "maestro" }, "uuid": "82ae874b-4e20-4805-9af5-afc6284cfd6f", "objectId": "6858f531739488bf7794df34" }, { "message": "Hello, Ryleigh! Your order number is: #28", "phoneNumber": "326.558.4969 x205", "phoneVariation": "+90 303 306 10 89", "status": "disabled", "name": { "first": "Jamal", "middle": "Jaden", "last": "Walsh" }, "username": "Jamal-Walsh", "password": "BWizLO9TgiWpBfx", "emails": [ "Marjolaine.Erdman59@gmail.com", "Wallace24@example.com" ], "location": { "street": "9854 Maximillian Shore", "city": "Port Keeleyfield", "state": "Nebraska", "country": "Mauritius", "zip": "68849", "coordinates": { "latitude": "-47.1167", "longitude": "-25.2413" } }, "website": "https://greedy-topic.org/", "domain": "violent-run.biz", "job": { "title": "Direct Tactics Architect", "descriptor": "Chief", "area": "Usability", "type": "Associate", "company": "Skiles - Mertz" }, "creditCard": { "number": "6475-6207-6966-1874-6446", "cvv": "898", "issuer": "american_express" }, "uuid": "c72dbf49-9f78-42fc-89e7-efa46384e52c", "objectId": "6858f531739488bf7794df35" }, { "message": "Hello, Evan! Your order number is: #97", "phoneNumber": "(595) 916-9453 x9615", "phoneVariation": "+90 385 422 10 18", "status": "active", "name": { "first": "Robbie", "middle": "Sawyer", "last": "Greenholt" }, "username": "Robbie-Greenholt", "password": "3jsczQqre_N8qwk", "emails": [ "Neoma43@gmail.com", "Eveline_Witting@gmail.com" ], "location": { "street": "19331 Brandyn Gateway", "city": "Fort Zella", "state": "Massachusetts", "country": "Comoros", "zip": "24875", "coordinates": { "latitude": "16.7491", "longitude": "98.6363" } }, "website": "https://broken-odometer.biz/", "domain": "shocking-conception.info", "job": { "title": "Regional Implementation Supervisor", "descriptor": "District", "area": "Accounts", "type": "Manager", "company": "D'Amore LLC" }, "creditCard": { "number": "3528-4767-5298-3592", "cvv": "864", "issuer": "american_express" }, "uuid": "2b6c0d2a-cbe2-4468-8a8d-3a072b15399e", "objectId": "6858f531739488bf7794df36" }, { "message": "Hello, Aiden! Your order number is: #74", "phoneNumber": "1-594-491-8820 x6284", "phoneVariation": "+90 337 305 10 37", "status": "disabled", "name": { "first": "Rick", "middle": "Marlowe", "last": "Gislason" }, "username": "Rick-Gislason", "password": "1hyb1AM3VvJYQnx", "emails": [ "Nyah_Hirthe86@gmail.com", "Garnett.Douglas28@example.com" ], "location": { "street": "4583 Clifton Road", "city": "Krajcikboro", "state": "Ohio", "country": "Mali", "zip": "18869", "coordinates": { "latitude": "17.0059", "longitude": "155.7033" } }, "website": "https://kosher-battalion.name/", "domain": "glistening-structure.info", "job": { "title": "Senior Identity Liaison", "descriptor": "Investor", "area": "Response", "type": "Manager", "company": "Purdy LLC" }, "creditCard": { "number": "2331-7384-5929-3511", "cvv": "986", "issuer": "maestro" }, "uuid": "f8696287-0236-4e02-b093-5d184a8ed0aa", "objectId": "6858f531739488bf7794df37" }, { "message": "Hello, Dillon! Your order number is: #72", "phoneNumber": "518.972.5428", "phoneVariation": "+90 372 527 10 97", "status": "disabled", "name": { "first": "Davon", "middle": "Ellis", "last": "Luettgen" }, "username": "Davon-Luettgen", "password": "BW8bbVG3hQFiU9d", "emails": [ "Karl_Yost@gmail.com", "Dario95@example.com" ], "location": { "street": "4117 Andy Club", "city": "Haneworth", "state": "Illinois", "country": "Slovenia", "zip": "68135-1940", "coordinates": { "latitude": "87.7457", "longitude": "-13.4573" } }, "website": "https://nutty-nightingale.info/", "domain": "happy-champion.info", "job": { "title": "Future Response Engineer", "descriptor": "Central", "area": "Markets", "type": "Architect", "company": "Stokes, Johns and Ortiz" }, "creditCard": { "number": "3051-612558-6338", "cvv": "659", "issuer": "discover" }, "uuid": "c8408de2-4fdd-43a7-8d80-5a955d6f5d50", "objectId": "6858f531739488bf7794df38" }, { "message": "Hello, Manuela! Your order number is: #70", "phoneNumber": "938.347.2020 x7385", "phoneVariation": "+90 349 107 10 75", "status": "active", "name": { "first": "Spencer", "middle": "Rory", "last": "Stanton" }, "username": "Spencer-Stanton", "password": "wrExAqxlkw8c2Gk", "emails": [ "Kristian.Fritsch19@example.com", "Alfonso_Braun@gmail.com" ], "location": { "street": "8289 Johnson Spurs", "city": "Joplin", "state": "Minnesota", "country": "Lebanon", "zip": "68011-4390", "coordinates": { "latitude": "23.3656", "longitude": "-22.3921" } }, "website": "https://important-cilantro.net", "domain": "chief-manservant.name", "job": { "title": "Senior Paradigm Officer", "descriptor": "Principal", "area": "Solutions", "type": "Associate", "company": "Lakin - Watsica" }, "creditCard": { "number": "3529-2826-5972-8182", "cvv": "398", "issuer": "maestro" }, "uuid": "06eee600-9651-4634-9d6f-3ad233ea6b0c", "objectId": "6858f531739488bf7794df39" }, { "message": "Hello, Claude! Your order number is: #41", "phoneNumber": "957-864-0912 x1643", "phoneVariation": "+90 353 450 10 34", "status": "active", "name": { "first": "Destiny", "middle": "Addison", "last": "Sporer" }, "username": "Destiny-Sporer", "password": "lVuRkRrP93Guye2", "emails": [ "Amos.Tromp@gmail.com", "Ignatius.OHara@gmail.com" ], "location": { "street": "60051 Bednar Shores", "city": "West Melisa", "state": "New Jersey", "country": "China", "zip": "23013-6780", "coordinates": { "latitude": "66.4046", "longitude": "97.6125" } }, "website": "https://dizzy-formation.com/", "domain": "grubby-inspector.biz", "job": { "title": "International Assurance Developer", "descriptor": "Dynamic", "area": "Quality", "type": "Manager", "company": "Denesik, Blick and Yundt" }, "creditCard": { "number": "2367-3264-7530-8856", "cvv": "153", "issuer": "discover" }, "uuid": "1c507845-f6a8-4c18-a7f9-566ea3f92507", "objectId": "6858f531739488bf7794df3a" }, { "message": "Hello, Garrick! Your order number is: #53", "phoneNumber": "(490) 277-6261", "phoneVariation": "+90 389 788 10 92", "status": "active", "name": { "first": "Agnes", "middle": "Jamie", "last": "Effertz" }, "username": "Agnes-Effertz", "password": "eWPRMUO4TastiN7", "emails": [ "Monty.Bosco@gmail.com", "Amaya.Blanda62@example.com" ], "location": { "street": "1792 N Harrison Street", "city": "Lake Jaimeside", "state": "Kentucky", "country": "Iraq", "zip": "57099", "coordinates": { "latitude": "25.3701", "longitude": "144.5729" } }, "website": "https://evergreen-goodnight.biz", "domain": "aware-error.org", "job": { "title": "Direct Quality Technician", "descriptor": "Dynamic", "area": "Applications", "type": "Liaison", "company": "Lang, Windler and Klocko" }, "creditCard": { "number": "4541620481647", "cvv": "307", "issuer": "maestro" }, "uuid": "66c6b3fb-dd56-44c8-b2ff-50919732e42f", "objectId": "6858f531739488bf7794df3b" }, { "message": "Hello, Mozelle! Your order number is: #51", "phoneNumber": "(589) 429-9620 x804", "phoneVariation": "+90 399 981 10 71", "status": "disabled", "name": { "first": "Velva", "middle": "London", "last": "Kuhic" }, "username": "Velva-Kuhic", "password": "72mSEIYEeeaUoOq", "emails": [ "Krystal.Krajcik42@example.com", "Joelle_Ledner68@example.com" ], "location": { "street": "502 Feeney Rapid", "city": "Turlock", "state": "Colorado", "country": "Japan", "zip": "99811", "coordinates": { "latitude": "-68.8424", "longitude": "106.8367" } }, "website": "https://ordinary-colonial.biz/", "domain": "unnatural-possible.net", "job": { "title": "Lead Accountability Executive", "descriptor": "Lead", "area": "Marketing", "type": "Strategist", "company": "Swaniawski, Abbott and Sipes" }, "creditCard": { "number": "4798111448218", "cvv": "618", "issuer": "visa" }, "uuid": "226b80b1-e745-404a-a305-1de11899fe55", "objectId": "6858f531739488bf7794df3c" }, { "message": "Hello, Monica! Your order number is: #7", "phoneNumber": "1-332-833-2359 x3200", "phoneVariation": "+90 330 702 10 77", "status": "disabled", "name": { "first": "Dejon", "middle": "Bowie", "last": "Gutkowski" }, "username": "Dejon-Gutkowski", "password": "jj_QS6kv7u9KlMW", "emails": [ "Alda.Roberts@gmail.com", "Braeden.Kub@gmail.com" ], "location": { "street": "95101 Tillman Trafficway", "city": "South Cloyd", "state": "Mississippi", "country": "Australia", "zip": "07773", "coordinates": { "latitude": "-2.9574", "longitude": "132.5908" } }, "website": "https://vigorous-policeman.biz", "domain": "weekly-android.com", "job": { "title": "Investor Program Producer", "descriptor": "Legacy", "area": "Operations", "type": "Strategist", "company": "Mertz - Dibbert" }, "creditCard": { "number": "3528-5138-4641-0263", "cvv": "841", "issuer": "mastercard" }, "uuid": "e182c12b-f15d-485d-8920-c9e1bff10291", "objectId": "6858f531739488bf7794df3d" }, { "message": "Hello, Meggie! Your order number is: #82", "phoneNumber": "331.993.4480 x3961", "phoneVariation": "+90 358 831 10 93", "status": "active", "name": { "first": "Felipa", "middle": "Elliott", "last": "Oberbrunner" }, "username": "Felipa-Oberbrunner", "password": "xrD38aivlKecbld", "emails": [ "Frederic21@gmail.com", "Retta92@gmail.com" ], "location": { "street": "94272 Meadow Way", "city": "North Sofiastad", "state": "Texas", "country": "Virgin Islands, British", "zip": "17853-8951", "coordinates": { "latitude": "15.514", "longitude": "-95.8946" } }, "website": "https://substantial-wire.biz", "domain": "cheap-complexity.net", "job": { "title": "Customer Web Technician", "descriptor": "Global", "area": "Markets", "type": "Technician", "company": "Wuckert - Hirthe" }, "creditCard": { "number": "2610-5716-1810-2675", "cvv": "278", "issuer": "jcb" }, "uuid": "e1ee3c00-2fb8-43d7-a405-b00990046651", "objectId": "6858f531739488bf7794df3e" }, { "message": "Hello, Itzel! Your order number is: #80", "phoneNumber": "217-593-4586 x502", "phoneVariation": "+90 313 256 10 14", "status": "disabled", "name": { "first": "Mustafa", "middle": "Jules", "last": "Kassulke" }, "username": "Mustafa-Kassulke", "password": "MzLc0hp0Yk47HZg", "emails": [ "Lewis.Jacobi21@gmail.com", "Eliseo_Durgan@example.com" ], "location": { "street": "754 Lauren Pine", "city": "North Elliotboro", "state": "West Virginia", "country": "Aland Islands", "zip": "44616", "coordinates": { "latitude": "73.7234", "longitude": "68.3543" } }, "website": "https://quaint-magazine.name", "domain": "babyish-carpeting.net", "job": { "title": "Product Operations Architect", "descriptor": "Corporate", "area": "Accountability", "type": "Producer", "company": "Zboncak, Wilderman and Vandervort" }, "creditCard": { "number": "3059-027635-4713", "cvv": "749", "issuer": "discover" }, "uuid": "2e7b7bfe-cd3b-4acf-aa60-89400adbbeeb", "objectId": "6858f531739488bf7794df3f" }, { "message": "Hello, Katlynn! Your order number is: #85", "phoneNumber": "653.975.3857 x9962", "phoneVariation": "+90 351 275 10 90", "status": "active", "name": { "first": "Hellen", "middle": "Kai", "last": "McCullough" }, "username": "Hellen-McCullough", "password": "rN30n9LOSGTWXnE", "emails": [ "Leonie.Satterfield@gmail.com", "Marcelino.Parker79@gmail.com" ], "location": { "street": "3584 Okuneva Crossroad", "city": "Crooksview", "state": "Washington", "country": "British Indian Ocean Territory (Chagos Archipelago)", "zip": "47351-9522", "coordinates": { "latitude": "72.6817", "longitude": "-51.6257" } }, "website": "https://adventurous-finish.info/", "domain": "adored-hardboard.info", "job": { "title": "Future Division Manager", "descriptor": "Chief", "area": "Communications", "type": "Producer", "company": "Feil - Mante" }, "creditCard": { "number": "2631-7529-0104-9667", "cvv": "143", "issuer": "visa" }, "uuid": "0879a9a7-50f9-42ce-be62-06e8afd42bf9", "objectId": "6858f531739488bf7794df40" }, { "message": "Hello, Sienna! Your order number is: #41", "phoneNumber": "452-235-8123", "phoneVariation": "+90 330 802 10 48", "status": "disabled", "name": { "first": "Michale", "middle": "Angel", "last": "Beer" }, "username": "Michale-Beer", "password": "FENOiwpk9yIAR8s", "emails": [ "Dustin53@example.com", "Adonis53@example.com" ], "location": { "street": "368 S Grand Avenue", "city": "Bethesda", "state": "Hawaii", "country": "Saint Helena", "zip": "92641-1865", "coordinates": { "latitude": "-17.9825", "longitude": "-92.8009" } }, "website": "https://aromatic-affinity.info", "domain": "unequaled-reliability.biz", "job": { "title": "Chief Integration Assistant", "descriptor": "Dynamic", "area": "Intranet", "type": "Designer", "company": "Hahn and Sons" }, "creditCard": { "number": "4903-0126-3394-8539", "cvv": "259", "issuer": "jcb" }, "uuid": "cc26864b-6a0c-43c9-b1f8-9af2e5de49af", "objectId": "6858f531739488bf7794df41" }, { "message": "Hello, Vivianne! Your order number is: #43", "phoneNumber": "1-991-629-5862 x182", "phoneVariation": "+90 344 482 10 68", "status": "active", "name": { "first": "Durward", "middle": "Taylor", "last": "Roob" }, "username": "Durward-Roob", "password": "MTEd7ZxLcvi6hYz", "emails": [ "Jevon.Runolfsson40@example.com", "Tobin28@gmail.com" ], "location": { "street": "8234 Ray Course", "city": "Port Shaniya", "state": "Rhode Island", "country": "Malta", "zip": "04225-4247", "coordinates": { "latitude": "-45.5029", "longitude": "-101.7868" } }, "website": "https://great-jasmine.biz/", "domain": "wavy-classic.net", "job": { "title": "Product Marketing Strategist", "descriptor": "Principal", "area": "Program", "type": "Associate", "company": "Jacobs and Sons" }, "creditCard": { "number": "3552-6971-2593-3530", "cvv": "880", "issuer": "discover" }, "uuid": "d7e0f53a-e16a-4112-b48d-17574b0c354b", "objectId": "6858f531739488bf7794df42" }, { "message": "Hello, Owen! Your order number is: #93", "phoneNumber": "(275) 705-3415 x0970", "phoneVariation": "+90 354 962 10 56", "status": "disabled", "name": { "first": "Hilton", "middle": "Robin", "last": "Greenholt" }, "username": "Hilton-Greenholt", "password": "xjclRj1s09CE1qX", "emails": [ "Nannie_Lehner@gmail.com", "Lennie.Huel13@example.com" ], "location": { "street": "12284 Hessel Place", "city": "Spinkaton", "state": "Ohio", "country": "British Indian Ocean Territory (Chagos Archipelago)", "zip": "48754-7850", "coordinates": { "latitude": "17.2193", "longitude": "-142.6309" } }, "website": "https://clear-cut-tailspin.biz/", "domain": "annual-parade.biz", "job": { "title": "Product Quality Specialist", "descriptor": "Central", "area": "Web", "type": "Representative", "company": "McDermott - Torphy" }, "creditCard": { "number": "5194-6222-9780-1074", "cvv": "936", "issuer": "maestro" }, "uuid": "f0df4aaf-3f17-4d5b-9c21-bbf40ada5868", "objectId": "6858f531739488bf7794df43" }, { "message": "Hello, Kallie! Your order number is: #5", "phoneNumber": "1-249-295-8523 x72358", "phoneVariation": "+90 384 102 10 84", "status": "active", "name": { "first": "Ramon", "middle": "North", "last": "Kemmer" }, "username": "Ramon-Kemmer", "password": "jbb9nYqPkwTGF54", "emails": [ "Kathleen_OConnell8@gmail.com", "Ara13@gmail.com" ], "location": { "street": "3101 Boyle Mills", "city": "Mayefield", "state": "Missouri", "country": "San Marino", "zip": "64667-4154", "coordinates": { "latitude": "49.8894", "longitude": "-141.7718" } }, "website": "https://bruised-jumbo.com", "domain": "plain-graffiti.org", "job": { "title": "District Markets Facilitator", "descriptor": "Corporate", "area": "Directives", "type": "Officer", "company": "Hyatt - Kris" }, "creditCard": { "number": "6500-6229-7684-2998-3212", "cvv": "220", "issuer": "diners_club" }, "uuid": "63448739-4a3a-4852-8ff3-bdca94d9eae3", "objectId": "6858f531739488bf7794df44" } ] );
Tests:
for
for (let i = 0; i < array.length; i++) { const obj = array[i]; name = obj.name; const emails = obj.emails || []; for (let j = 0; j < emails.length; i++) { const em = obj.emails[j]; email = em } }
foreach
array.forEach(function(obj) { name = obj.name; const emails = obj.emails || []; emails.forEach(function(em) { email = em; }); });
for in
for (const key in array) { const obj = array[key]; name = obj.name; const emails = obj.emails || []; for (const em in emails) { email = em; } }
for..of
for (const obj of array) { name = obj.name; const emails = obj.emails || []; for (const em of emails) { email = em; } }