Skip to content

Instantly share code, notes, and snippets.

@JobLeonard
Created January 31, 2023 11:31
Show Gist options
  • Select an option

  • Save JobLeonard/c517ccbb403807c412b4e035a07c61dd to your computer and use it in GitHub Desktop.

Select an option

Save JobLeonard/c517ccbb403807c412b4e035a07c61dd to your computer and use it in GitHub Desktop.
My Test
{"title":"My Test","initialization":"// runs once\n\"use strict\";\nconst t = new Float64Array(10000);","setup":"// runs before each test\n\nfor (let i = 0, {random} = Math; i < t.length; i++) {\n const v = random();\n t[i] = v > 0.1 ? v : NaN;\n}","tests":[{"name":"test 1","code":"// put test code here\n// !isFinite(x)\n\nconst {isFinite} = Number;\nfor (let i = 0; i < t.length; i++) {\n const x = t[i];\n if (!isFinite(x)) t[i] = 0;\n}","results":{"aborted":false,"count":4352,"cycles":5,"hz":47030.46934354578,"stats":{"moe":5.759182169229484e-7,"rme":2.708570404538427,"sem":2.938358249606879e-7,"deviation":0.0000021188802669280435,"mean":0.00002126281140626624,"variance":4.489653585577057e-12,"numSamples":52},"times":{"cycle":0.09253575524007068,"elapsed":6.085,"period":0.00002126281140626624,"timeStamp":1675164683542}},"platforms":{"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0":{"aborted":false,"count":4352,"cycles":5,"hz":47030.46934354578,"stats":{"moe":5.759182169229484e-7,"rme":2.708570404538427,"sem":2.938358249606879e-7,"deviation":0.0000021188802669280435,"mean":0.00002126281140626624,"variance":4.489653585577057e-12,"numSamples":52},"times":{"cycle":0.09253575524007068,"elapsed":6.085,"period":0.00002126281140626624,"timeStamp":1675164683542}}}},{"name":"test 2","code":"// put test code here\n// x => typeof x === \"number\" && x < Infinity && x > -Infinity\nfor (let i = 0; i < t.length; i++) {\n const x = t[i];\n if (!(typeof x === \"number\" && x < Infinity && x > -Infinity)) t[i] = 0;\n}","results":{"aborted":false,"count":4934,"cycles":5,"hz":55892.40324054401,"stats":{"moe":2.744823609011477e-7,"rme":1.5341478797903478,"sem":1.400420208679325e-7,"deviation":0.0000010479785236785002,"mean":0.000017891519097797643,"variance":1.0982589860913686e-12,"numSamples":56},"times":{"cycle":0.08827675522853357,"elapsed":6.012,"period":0.000017891519097797643,"timeStamp":1675164689633}},"platforms":{"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0":{"aborted":false,"count":4934,"cycles":5,"hz":55892.40324054401,"stats":{"moe":2.744823609011477e-7,"rme":1.5341478797903478,"sem":1.400420208679325e-7,"deviation":0.0000010479785236785002,"mean":0.000017891519097797643,"variance":1.0982589860913686e-12,"numSamples":56},"times":{"cycle":0.08827675522853357,"elapsed":6.012,"period":0.000017891519097797643,"timeStamp":1675164689633}}}}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment