Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
test dict find with rando
(version: 1)
Comparing performance of:
find vs d
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"></script>
Script Preparation code:
var myArr = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']; var myDict = _.keyBy(myArr); function randomChar(charType = "any") { const lowercase = "abcdefghijklmnopqrstuvwxyz"; const uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const digits = "0123456789"; let characters = ""; switch (charType) { case "lower": characters = lowercase; break; case "upper": characters = uppercase; break; case "digit": characters = digits; break; default: characters = lowercase + uppercase + digits; break; } const randomIndex = Math.floor(Math.random() * characters.length); return characters[randomIndex]; }
Tests:
find
if (myArr.find((l) => l === randomChar())) { console.log("array has 'm'"); }
d
if (myDict[randomChar()]) { console.log("dict has 'm'"); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
find
d
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Browser/OS:
Chrome 130 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
find
251443.4 Ops/sec
d
1006869.9 Ops/sec
Related benchmarks:
Substring Test
Slowest character conversion
Rafa speed test 1
comparing Map and object
IndexOf vs Includes vs lodash includes vs dictionary with large array
Object.create(null) vs {} vs Map() key access (heavy)
Array find vs includes (temp3214)
test of find
test dict find
Comments
Confirm delete:
Do you really want to delete benchmark?