Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Redundant Lookups
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser:
Chrome 132
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Redundant
145407664.0 Ops/sec
Not Redundant
158383056.0 Ops/sec
Script Preparation code:
var testObject = { 'reallyLongStringsProbably': 0, 'anotherReallyLongStringProbably': 1, 'shortString1': 2, 'shortString2': 3, 'shortString3': 4, 'shortString4': 5, 'shortString5': 6, 'shortString6': 7, 'shortString7': 8, 'moreLongStringsThatArePrettyLong': 9, 'moreLongStringsThatArePrettyLong2': 10, 'moreLongStringsThatArePrettyLong3': 11, 'moreLongStringsThatArePrettyLong4': 12, }; function cacheLookupRedundant(name) { if (!testObject[name]) { testObject[name] = 13; } return testObject[name]; } function cacheLookupNotRedundant(name) { let value = testObject[name]; if (!value) { value = 13; testObject[name] = value; } return value; }
Tests:
Redundant
cacheLookupRedundant('someStringThatsAParameter');
Not Redundant
cacheLookupNotRedundant('someStringThatsAParameter');