1 import Benchmark from 'benny'
2 import { generateRandomNumberArray } from './benchmark-utils.mjs'
5 let testArray = generateRandomNumberArray(size)
8 `Empty array with ${size} elements`,
9 Benchmark.add('length = 0', () => {
12 Benchmark.add('pop loop', () => {
13 while (testArray.length > 0) {
17 Benchmark.add('splice', () => {
18 testArray.splice(0, testArray.length)
20 Benchmark.add('shift loop', () => {
21 while (testArray.length > 0) {
25 Benchmark.add('new init', () => {
30 Benchmark.save({ file: 'empty-array', format: 'json', details: true }),
31 Benchmark.save({ file: 'empty-array', format: 'chart.html', details: true }),
32 Benchmark.save({ file: 'empty-array', format: 'table.html', details: true })