From d2391d5425f0eaab135ead4298520c4e0a4d00cb Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Fri, 15 Mar 2019 13:09:17 -0400 Subject: [PATCH] chore: use async-await for benchmarks --- benchmarks/hash.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/benchmarks/hash.js b/benchmarks/hash.js index b0ad8f92..20409ec9 100644 --- a/benchmarks/hash.js +++ b/benchmarks/hash.js @@ -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 })