Bump prettier from 2.8.5 to 2.8.6
[benchmarks-js.git] / empty-array.js
index 9ddc17d45b06d37b57c77129d0d1ed7b69620480..a56a82461f8ef272cf0210df5e81abd069ae8cc6 100644 (file)
@@ -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', () => {
@@ -26,6 +27,7 @@ Benchmark.suite(
   }),
   Benchmark.cycle(),
   Benchmark.complete(),
-  Benchmark.save({ file: 'empty-array', format: 'chart.html' }),
-  Benchmark.save({ file: 'empty-array', format: 'table.html' })
+  Benchmark.save({ file: 'empty-array', format: 'json', details: true }),
+  Benchmark.save({ file: 'empty-array', format: 'chart.html', details: true }),
+  Benchmark.save({ file: 'empty-array', format: 'table.html', details: true })
 )