Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

chore: use async-await for benchmarks #41

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions benchmarks/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@ const algs = [
]

algs.forEach((alg) => {
suite.add(alg, function (d) {
suite.add(alg, async function (d) {
const buf = Buffer.alloc(10 * 1024)
buf.fill(Math.ceil(Math.random() * 100))
multihashing(buf, alg)
.then(res => {
list.push(res)
d.resolve()
})
.catch(err => console.log(err))
const res = await multihashing(buf, alg)
list.push(res)
d.resolve()
}, {
defer: true
})
Expand Down