Skip to content

Instantly share code, notes, and snippets.

@JobLeonard
Last active February 26, 2024 14:50
Show Gist options
  • Save JobLeonard/aced59084e9c50e2f9f297cf9fb8d747 to your computer and use it in GitHub Desktop.
Save JobLeonard/aced59084e9c50e2f9f297cf9fb8d747 to your computer and use it in GitHub Desktop.
new Cell vs createCell
{"title":"new Cell vs createCell","initialization":"class Cell {\n constructor(fcsFiles) {\n this.fcsFiles = fcsFiles;\n this.fcsFile = fcsFiles.length === 1 ? fcsFiles[0] : null;\n this.fcsFileId = this.fcsFile?._id ?? null;\n }\n}\n\nfunction createCell(fcsFiles) {\n return {\n fcsFiles,\n fcsFile: fcsFiles.length === 1 ? fcsFiles[0] : null,\n fcsFileId: fcsFiles[0]?._id ?? null\n };\n}","setup":"// runs before each test","tests":[{"name":"new Cell(fcsFiles)","code":"let t = new Cell([]);\nt = new Cell([{_id: 1}]);\nt = new Cell([{_id: 1}, {_id: 2}]);","results":{"aborted":false,"count":970458,"cycles":6,"hz":11979634.773929393,"stats":{"moe":9.32547293492025e-10,"rme":1.1171575985450803,"sem":4.757894354551148e-10,"deviation":3.8063154836409185e-9,"mean":8.347499893538022e-8,"variance":1.44880375610046e-17,"numSamples":64},"times":{"cycle":0.08100898051683122,"elapsed":5.936,"period":8.347499893538022e-8,"timeStamp":1708958981693}},"platforms":{"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36":{"aborted":false,"count":18145599,"cycles":8,"hz":230617054.7677627,"stats":{"moe":7.962984294986317e-11,"rme":1.8363999852716937,"sem":4.062747089278733e-11,"deviation":3.275491419991484e-10,"mean":4.336192746052653e-9,"variance":1.072884404243783e-19,"numSamples":65},"times":{"cycle":0.07868281475658027,"elapsed":6.075,"period":4.336192746052653e-9,"timeStamp":1708958741176}},"Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0":{"aborted":false,"count":970458,"cycles":6,"hz":11979634.773929393,"stats":{"moe":9.32547293492025e-10,"rme":1.1171575985450803,"sem":4.757894354551148e-10,"deviation":3.8063154836409185e-9,"mean":8.347499893538022e-8,"variance":1.44880375610046e-17,"numSamples":64},"times":{"cycle":0.08100898051683122,"elapsed":5.936,"period":8.347499893538022e-8,"timeStamp":1708958981693}}}},{"name":"createCell(fcsFiles)","code":"let t = createCell([]);\nt = createCell([{_id: 1}]);\nt = createCell([{_id: 1}, {_id: 2}]);","results":{"aborted":false,"count":1880099,"cycles":6,"hz":23678471.81249582,"stats":{"moe":3.2322164553217227e-10,"rme":0.7653394622922057,"sem":1.6490900282253688e-10,"deviation":1.3295388857701852e-9,"mean":4.223245519891494e-8,"variance":1.7676736487750257e-18,"numSamples":65},"times":{"cycle":0.07940119678702479,"elapsed":5.931,"period":4.223245519891494e-8,"timeStamp":1708958987635}},"platforms":{"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36":{"aborted":false,"count":13287502,"cycles":7,"hz":171100452.29877588,"stats":{"moe":4.568916381334674e-11,"rme":0.7817436593616491,"sem":2.331079786395242e-11,"deviation":1.9080710391026131e-10,"mean":5.8445199095897095e-9,"variance":3.640735090262126e-20,"numSamples":67},"times":{"cycle":0.07765906998771309,"elapsed":6.123,"period":5.8445199095897095e-9,"timeStamp":1708958747256}},"Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0":{"aborted":false,"count":1880099,"cycles":6,"hz":23678471.81249582,"stats":{"moe":3.2322164553217227e-10,"rme":0.7653394622922057,"sem":1.6490900282253688e-10,"deviation":1.3295388857701852e-9,"mean":4.223245519891494e-8,"variance":1.7676736487750257e-18,"numSamples":65},"times":{"cycle":0.07940119678702479,"elapsed":5.931,"period":4.223245519891494e-8,"timeStamp":1708958987635}}}}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment