Skip to content

Instantly share code, notes, and snippets.

@JobLeonard
Last active April 21, 2025 10:56
Show Gist options
  • Save JobLeonard/d165c561ea676a913f618412befb6324 to your computer and use it in GitHub Desktop.
Save JobLeonard/d165c561ea676a913f618412befb6324 to your computer and use it in GitHub Desktop.
Compare two arrays of 100 different elements
{"title":"Compare two arrays of 100 different elements","initialization":"const arr1 = [], arr2 = [];\nfor (let i = 0; i < 100; i++) {\n arr1[i] = Math.random();\n arr2[i] = Math.random();\n}","setup":"for (let i = 0; i < 100; i++) {\n arr1[i] = Math.random();\n arr2[i] = Math.random();\n}","tests":[{"name":"_.isEqual(arr1, arr2)","code":"_.isEqual(arr1, arr2)","results":{"aborted":false,"count":248918,"cycles":7,"hz":3060075.297733386,"stats":{"moe":4.657109291087769e-9,"rme":1.4251105100502324,"sem":2.3760761689223313e-9,"deviation":1.900860935137865e-8,"mean":3.267893442820526e-7,"variance":3.613272294733199e-16,"numSamples":64},"times":{"cycle":0.08134374999999996,"elapsed":6.005,"period":3.267893442820526e-7,"timeStamp":1745232974199}},"platforms":{"Mozilla/5.0 (X11; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0":{"aborted":false,"count":248918,"cycles":7,"hz":3060075.297733386,"stats":{"moe":4.657109291087769e-9,"rme":1.4251105100502324,"sem":2.3760761689223313e-9,"deviation":1.900860935137865e-8,"mean":3.267893442820526e-7,"variance":3.613272294733199e-16,"numSamples":64},"times":{"cycle":0.08134374999999996,"elapsed":6.005,"period":3.267893442820526e-7,"timeStamp":1745232974199}},"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36":{"aborted":false,"count":475933,"cycles":7,"hz":6145811.973527762,"stats":{"moe":9.527532619646866e-10,"rme":0.5855442405200203,"sem":4.860986030432075e-10,"deviation":3.978888547823044e-9,"mean":1.6271242991281903e-7,"variance":1.5831554075997373e-17,"numSamples":67},"times":{"cycle":0.0774402149056977,"elapsed":6.097,"period":1.6271242991281903e-7,"timeStamp":1745232942036}}}},{"name":"arr1.toString() === arr2.toString()","code":"arr1.toString() === arr2.toString();","results":{"aborted":false,"count":3259,"cycles":4,"hz":41006.428401879166,"stats":{"moe":2.5883753770170736e-7,"rme":1.0614002957483761,"sem":1.3205996821515682e-7,"deviation":0.0000010647015019827081,"mean":0.000024386420348526962,"variance":1.1335892883242348e-12,"numSamples":65},"times":{"cycle":0.07947534391584937,"elapsed":6.017,"period":0.000024386420348526962,"timeStamp":1745232980210}},"platforms":{"Mozilla/5.0 (X11; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0":{"aborted":false,"count":3259,"cycles":4,"hz":41006.428401879166,"stats":{"moe":2.5883753770170736e-7,"rme":1.0614002957483761,"sem":1.3205996821515682e-7,"deviation":0.0000010647015019827081,"mean":0.000024386420348526962,"variance":1.1335892883242348e-12,"numSamples":65},"times":{"cycle":0.07947534391584937,"elapsed":6.017,"period":0.000024386420348526962,"timeStamp":1745232980210}},"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36":{"aborted":false,"count":7196,"cycles":4,"hz":89646.71584422459,"stats":{"moe":1.2875359068929727e-7,"rme":1.1542336558447033,"sem":6.569060749453942e-8,"deviation":5.296146092632892e-7,"mean":0.000011154898320398696,"variance":2.804916343451065e-13,"numSamples":65},"times":{"cycle":0.08027064831358902,"elapsed":5.995,"period":0.000011154898320398696,"timeStamp":1745232948139}}}}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment