X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=empty-array.js;h=a56a82461f8ef272cf0210df5e81abd069ae8cc6;hb=9edceaea06312877a6b65739fdbc49f1c4e07290;hp=0c5f725e43122a307beae3468f05919a48e130de;hpb=fb341cfe4ddb61a33ab7dccb644aa8d6a0049f21;p=benchmarks-js.git diff --git a/empty-array.js b/empty-array.js index 0c5f725..a56a824 100644 --- a/empty-array.js +++ b/empty-array.js @@ -1,19 +1,20 @@ const Benchmark = require('benny') -const { generateRandomIntegerArray } = require('./benchmark-utils') +const { generateRandomNumberArray } = require('./benchmark-utils') -let testArray = generateRandomIntegerArray(10000) +const size = 10000 +let testArray = generateRandomNumberArray(size) Benchmark.suite( - 'Empty array', + `Empty array with ${size} elements`, Benchmark.add('length = 0', () => { testArray.length = 0 }), - Benchmark.add('pop loop', async () => { + Benchmark.add('pop loop', () => { while (testArray.length > 0) { testArray.pop() } }), - Benchmark.add('splice', async () => { + Benchmark.add('splice', () => { testArray.splice(0, testArray.length) }), Benchmark.add('shift loop', () => {