Skip to content

Commit

Permalink
moved benchmark to tibybench (#486)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrey Sitnik <andrey@sitnik.ru>
  • Loading branch information
Ledchig and ai authored Jun 25, 2024
1 parent 51659b4 commit 1eb7a36
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions test/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,16 @@ bench
.add('rndm', () => {
rndm(21)
})

bench.addEventListener('cycle', event => {
let name = event.task.name.padEnd('async secure-random-string'.length)
let hz = formatNumber(event.task.result.hz.toFixed(0)).padStart(10)
if (event.task.name === 'uid') {
name = '\nNon-secure:\n' + name
}
process.stdout.write(
`${name}${styleText('bold', hz)}${styleText('dim', ' ops/sec')}\n`
)
})
.addEventListener('cycle', event => {
let name = event.task.name.padEnd('async secure-random-string'.length)
let hz = formatNumber(event.task.result.hz.toFixed(0)).padStart(10)
if (event.task.name === 'uid') {
name = '\nNon-secure:\n' + name
}
process.stdout.write(
`${name}${styleText('bold', hz)}${styleText('dim', ' ops/sec')}\n`
)
})

await bench.warmup()
await bench.run()

0 comments on commit 1eb7a36

Please sign in to comment.