9f93d3267ae33b089d661b7b11ecba06e5a8b4c3
1 const Benchmark
= require('benchmark')
2 const { LIST_FORMATTER
} = require('./benchmark-utils')
4 const suite
= new Benchmark
.Suite()
7 83, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32, 45, 93, 17, 28, 83, 62,
8 99, 36, 28, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32, 45, 93, 17, 28,
9 83, 62, 99, 36, 28, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32, 45, 93,
10 17, 28, 83, 62, 99, 36, 28, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32,
11 45, 93, 17, 28, 83, 62, 99, 36, 28, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67,
12 77, 32, 45, 93, 17, 28, 83, 62, 99, 36, 28, 93, 27, 29, 2828, 234, 23, 56, 32,
13 56, 67, 77, 32, 45, 93, 17, 28, 83, 62, 99, 36, 28, 93, 27, 29, 2828, 234, 23,
14 56, 32, 56, 67, 77, 32, 45, 93, 17, 28, 83, 62, 99, 36, 28, 93, 27, 29, 2828,
15 234, 23, 56, 32, 56, 67, 77, 32, 45, 93, 17, 28, 83, 62, 99, 36, 28, 93, 27,
16 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32, 45, 93, 17, 28, 83, 62, 99, 36, 28,
17 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32, 45, 93, 17, 28, 83, 62, 99,
22 .add('length = 0', () => {
25 .add('pop loop', async () => {
26 while (testArray
.length
> 0) {
30 .add('splice', async () => {
31 testArray
.splice(0, testArray
.length
)
33 .add('shift loop', () => {
34 while (testArray
.length
> 0) {
38 .add('new init', () => {
41 .on('cycle', event
=> {
42 console
.log(event
.target
.toString())
44 .on('complete', function () {
46 'Fastest is ' + LIST_FORMATTER
.format(this.filter('fastest').map('name'))
48 // eslint-disable-next-line n/no-process-exit