1 const Benchmark
= require('benny')
2 const { generateRandomNumberArray
} = require('./benchmark-utils')
4 let testArray
= generateRandomNumberArray(10000)
8 Benchmark
.add('length = 0', () => {
11 Benchmark
.add('pop loop', () => {
12 while (testArray
.length
> 0) {
16 Benchmark
.add('splice', () => {
17 testArray
.splice(0, testArray
.length
)
19 Benchmark
.add('shift loop', () => {
20 while (testArray
.length
> 0) {
24 Benchmark
.add('new init', () => {
29 Benchmark
.save({ file
: 'empty-array', format
: 'json', details
: true }),
30 Benchmark
.save({ file
: 'empty-array', format
: 'chart.html', details
: true }),
31 Benchmark
.save({ file
: 'empty-array', format
: 'table.html', details
: true })