Skip to content

Instantly share code, notes, and snippets.

@JobLeonard
Last active April 21, 2025 10:53
Show Gist options
  • Save JobLeonard/5054d88da72974c9cff9edcd5d2d8fd0 to your computer and use it in GitHub Desktop.
Save JobLeonard/5054d88da72974c9cff9edcd5d2d8fd0 to your computer and use it in GitHub Desktop.
Compare two arrays of 100 equal elements
{"title":"Compare two arrays of 100 equal elements","initialization":"const arr1 = [], arr2 = [];\nfor (let i = 0; i < 100; i++) {\n arr1[i] = arr2[i] = Math.random();\n}","setup":"for (let i = 0; i < 100; i++) {\n arr1[i] = arr2[i] = Math.random();\n}","tests":[{"name":"_.isEqual(arr1, arr2)","code":"_.isEqual(arr1, arr2)","results":{"aborted":false,"count":91665,"cycles":5,"hz":1143685.3576588521,"stats":{"moe":1.0868689767670839e-8,"rme":1.243036134422173,"sem":5.5452498814647135e-9,"deviation":4.436199905171771e-8,"mean":8.743663572357181e-7,"variance":1.9679869598646027e-15,"numSamples":64},"times":{"cycle":0.0801487921360121,"elapsed":5.922,"period":8.743663572357181e-7,"timeStamp":1745232803021}},"platforms":{"Mozilla/5.0 (X11; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0":{"aborted":false,"count":91665,"cycles":5,"hz":1143685.3576588521,"stats":{"moe":1.0868689767670839e-8,"rme":1.243036134422173,"sem":5.5452498814647135e-9,"deviation":4.436199905171771e-8,"mean":8.743663572357181e-7,"variance":1.9679869598646027e-15,"numSamples":64},"times":{"cycle":0.0801487921360121,"elapsed":5.922,"period":8.743663572357181e-7,"timeStamp":1745232803021}},"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36":{"aborted":false,"count":118360,"cycles":6,"hz":1493732.0285604831,"stats":{"moe":3.9165791873474895e-9,"rme":0.5850319774534334,"sem":1.9982546874221886e-9,"deviation":1.6110444336743437e-8,"mean":6.694641213281775e-7,"variance":2.5954641672730867e-16,"numSamples":65},"times":{"cycle":0.07923777340040308,"elapsed":6.055,"period":6.694641213281775e-7,"timeStamp":1745232778969}}}},{"name":"arr1.toString() === arr2.toString()","code":"arr1.toString() === arr2.toString();","results":{"aborted":false,"count":3316,"cycles":7,"hz":41938.82474173938,"stats":{"moe":2.516795527070138e-7,"rme":1.0555144652058812,"sem":1.2840793505459887e-7,"deviation":0.0000010431909958435615,"mean":0.000023844254247896354,"variance":1.0882474538090816e-12,"numSamples":66},"times":{"cycle":0.07906754708602431,"elapsed":6.143,"period":0.000023844254247896354,"timeStamp":1745232808948}},"platforms":{"Mozilla/5.0 (X11; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0":{"aborted":false,"count":3316,"cycles":7,"hz":41938.82474173938,"stats":{"moe":2.516795527070138e-7,"rme":1.0555144652058812,"sem":1.2840793505459887e-7,"deviation":0.0000010431909958435615,"mean":0.000023844254247896354,"variance":1.0882474538090816e-12,"numSamples":66},"times":{"cycle":0.07906754708602431,"elapsed":6.143,"period":0.000023844254247896354,"timeStamp":1745232808948}},"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36":{"aborted":false,"count":7121,"cycles":4,"hz":90512.3235032751,"stats":{"moe":1.0294530083501297e-7,"rme":0.931781837232067,"sem":5.2523112670924986e-8,"deviation":4.299202058883249e-7,"mean":0.000011048219306444122,"variance":1.8483138343105967e-13,"numSamples":67},"times":{"cycle":0.0786743696811886,"elapsed":6.152,"period":0.000011048219306444122,"timeStamp":1745232785029}}}}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment