Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
object loop3
(version: 0)
Comparing performance of:
Object.entries vs for in
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var price = 500; var result = { "AED": "0.024878", "AFN": "0.572242", "ALL": "0.69308", "AMD": "2.613214", "ANG": "0.012214", "AOA": "5.601538", "ARS": "2.370693", "AUD": "0.010619", "AWG": "0.012209", "AZN": "0.011547", "BAM": "0.012342", "BBD": "0.013684", "BDT": "0.743813", "BGN": "0.012343", "BHD": "0.002554", "BIF": "19.25656", "BMD": "0.006773", "BND": "0.009229", "BOB": "0.046829", "BRL": "0.033657", "BSD": "0.006777", "BTC": "2.63049e-07", "BTN": "0.563006", "BWP": "0.092841", "BYN": "0.017109", "BYR": "132.757151", "BZD": "0.013661", "CAD": "0.00923", "CDF": "16.831714", "CHF": "0.006021", "CLF": "0.000214", "CLP": "5.914264", "CNY": "0.049489", "COP": "27.650334", "CRC": "3.63726", "CUC": "0.006773", "CUP": "0.179493", "CVE": "0.692571", "CZK": "0.152948", "DJF": "1.206696", "DKK": "0.047126", "DOP": "0.384389", "DZD": "0.928254", "EGP": "0.209283", "ERN": "0.1016", "ETB": "0.372597", "EUR": "0.006322", "FJD": "0.015408", "FKP": "0.005365", "GBP": "0.005395", "GEL": "0.017848", "GGP": "0.005365", "GHS": "0.077047", "GIP": "0.005365", "GMD": "0.412159", "GNF": "58.352187", "GTQ": "0.053366", "GYD": "1.417882", "HKD": "0.053102", "HNL": "0.168825", "HRK": "0.046619", "HTG": "0.917603", "HUF": "2.452608", "IDR": "103.550578", "ILS": "0.025745", "IMP": "0.005365", "INR": "0.562653", "IQD": "8.873054", "IRR": "286.342272", "ISK": "0.906", "JEP": "0.005365", "JMD": "1.044695", "JOD": "0.004796", "KES": "0.988568", "KGS": "0.597881", "KHR": "28.07543", "KMF": "3.08186", "KPW": "6.096189", "KRW": "9.023153", "KWD": "0.00209", "KYD": "0.005648", "KZT": "3.121999", "LAK": "131.199288", "LBP": "103.293188", "LKR": "2.189137", "LRD": "1.259836", "LSL": "0.127135", "LTL": "0.02", "LVL": "0.004097", "LYD": "0.032681", "MAD": "0.068021", "MDL": "0.120971", "MGA": "30.310623", "MKD": "0.388568", "MMK": "14.231698", "MNT": "23.547507", "MOP": "0.054733", "MRO": "2.418076", "MUR": "0.309174", "MVR": "0.10431", "MWK": "7.305011", "MXN": "0.117449", "MYR": "0.031462", "MZN": "0.428412", "NAD": "0.127136", "NGN": "5.120636", "NIO": "0.247565", "NOK": "0.072752", "NPR": "0.900788", "NZD": "0.011519", "OMR": "0.002608", "PAB": "0.006777", "PEN": "0.025041", "PGK": "0.023841", "PHP": "0.386557", "PKR": "2.048947", "PLN": "0.02844", "PYG": "49.283715", "QAR": "0.024661", "RON": "0.031328", "RSD": "0.74145", "RUB": "0.661866", "RWF": "8.060256", "SAR": "0.025407", "SBD": "0.056689", "SCR": "0.089906", "SDG": "4.072597", "SEK": "0.075268", "SGD": "0.009219", "SHP": "0.008241", "SLE": "0.152024", "SLL": "133.773149", "SOS": "3.85064", "SRD": "0.258812", "SSP": "4.0742", "STD": "140.194132", "SYP": "88.063373", "SZL": "0.127135", "THB": "0.240409", "TJS": "0.074445", "TMT": "0.023774", "TND": "0.020947", "TOP": "0.016173", "TRY": "0.181543", "TTD": "0.045939", "TWD": "0.216181", "TZS": "16.967176", "UAH": "0.250303", "UGX": "25.280143", "USD": "0.006773", "UYU": "0.254879", "UZS": "88.561213", "VEF": "22196.750091", "VES": "0.217683", "VND": "162.593644", "VUV": "0.823013", "WST": "0.018822", "XAF": "4.139385", "XAG": "0.000285", "XAU": "3.512916e-06", "XCD": "0.018305", "XDR": "0.005096", "XOF": "4.087702", "XPF": "0.749943", "YER": "1.695701", "ZAR": "0.130351", "ZMK": "60.967948", "ZMW": "0.138758", "ZWL": "2.181008" };
Tests:
Object.entries
for (const [currencyCode, rate] of Object.entries(result)) { console.log(currencyCode, rate); }
for in
for (const prop in result) { if (Object.prototype.hasOwnProperty.call(result, prop)) { console.log(prop, result[prop]); } }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Object.entries
for in
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
I'll do my best to answer your question. It appears that we have a JSON object with currency exchange rates and some benchmarking data. You'd like me to extract the currency codes from the JSON object, but I don't see any explicit request for this. However, based on the provided benchmarking data, it seems that one of the test cases is `Object.entries`, which iterates over a JSON object's key-value pairs and returns them as an array of tuples. If you'd like to extract the currency codes from the JSON object, I can do that for you. The JSON object contains the following currencies: * USD * RSD * RUB * RWF * SAR * SBD * SCR * SDG * SEK * SGD * SHP * SLE * SLL * SOS * SRD * SSP * STD * SYP * SZL * THB * TJS * TMT * TND * TOP * TRY * TTD * TWD * TZS * UAH * UGX * VES * VND * VUV * WST Here is the code to extract the currency codes: ```javascript const currencies = Object.keys(result); console.log(currencies); ``` Please note that this will log an array of strings, where each string represents a currency code. If you have any further questions or would like me to elaborate on any part of the JSON object or benchmarking data, feel free to ask!
Related benchmarks:
ArrayFind
Test Immutable ToJS vs get
Test Immutable ToJS vs single get
spread v splice
Slice vs For - 100 item
Comments
Confirm delete:
Do you really want to delete benchmark?