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

Commit

Permalink
chore: use async-await for benchmarks (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmc authored and hugomrdias committed Apr 16, 2019
1 parent a91a159 commit bf59286
Showing 1 changed file with 4 additions and 7 deletions.
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

0 comments on commit bf59286

Please sign in to comment.