mirror of
https://github.com/bcomnes/deploy-to-neocities.git
synced 2026-01-21 00:46:29 +00:00
0.0.1
This commit is contained in:
34
node_modules/fast-fifo/bench.js
generated
vendored
Normal file
34
node_modules/fast-fifo/bench.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
const FastFIFO = require('./')
|
||||
const FIFO = require('fifo')
|
||||
|
||||
run(new FIFO(), 'fifo')
|
||||
run(new FastFIFO(), 'fast-fifo')
|
||||
run(new FIFO(), 'fifo')
|
||||
run(new FastFIFO(), 'fast-fifo')
|
||||
|
||||
function run (q, prefix) {
|
||||
const runs = 1024
|
||||
|
||||
console.time(prefix + ' bulk push and shift')
|
||||
|
||||
for (let j = 0; j < 1e5; j++) {
|
||||
for (let i = 0; i < runs; i++) {
|
||||
q.push(i)
|
||||
}
|
||||
for (let i = 0; i < runs; i++) {
|
||||
q.shift()
|
||||
}
|
||||
}
|
||||
|
||||
console.timeEnd(prefix + ' bulk push and shift')
|
||||
console.time(prefix + ' individual push and shift')
|
||||
|
||||
for (let j = 0; j < 1e5; j++) {
|
||||
for (let i = 0; i < runs; i++) {
|
||||
q.push(i)
|
||||
q.shift()
|
||||
}
|
||||
}
|
||||
|
||||
console.timeEnd(prefix + ' individual push and shift')
|
||||
}
|
||||
Reference in New Issue
Block a user