Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2022-01-17 08:31:21 +0300
committerDanielle Adams <adamzdanielle@gmail.com>2022-02-26 06:33:56 +0300
commitec72cb401938a3767e61f3e389d0a92ed2620d7c (patch)
tree41fe24fd76e6eb56d0c4777eb1a99e19ccc9e5c3 /benchmark
parentf2ca172a08445b26289cbe2386fe1bb4ecbae820 (diff)
benchmark: remove unreachable code from crypto/hash-stream-creation
`hash.digest('buffer')` has returned a Buffer and not a string since at least Node.js 0.10.6. The benchmark, as it is written, will not work on any version of Node.js prior to 16.x (due to `Object.hasOwn()`) and certainly won't run on versions earlier than 0.10.6 due to const/let and probably other things. Remove impossible-to-reach code intended to accommodate Node.js earlier than 0.10.6. PR-URL: https://github.com/nodejs/node/pull/41535 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/crypto/hash-stream-creation.js6
1 files changed, 1 insertions, 5 deletions
diff --git a/benchmark/crypto/hash-stream-creation.js b/benchmark/crypto/hash-stream-creation.js
index c21eb6eaaae..e480c7b6edc 100644
--- a/benchmark/crypto/hash-stream-creation.js
+++ b/benchmark/crypto/hash-stream-creation.js
@@ -52,11 +52,7 @@ function legacyWrite(algo, message, encoding, writes, len, outEnc) {
while (writes-- > 0) {
const h = crypto.createHash(algo);
h.update(message, encoding);
- let res = h.digest(outEnc);
-
- // Include buffer creation costs for older versions
- if (outEnc === 'buffer' && typeof res === 'string')
- res = Buffer.from(res, 'binary');
+ h.digest(outEnc);
}
bench.end(gbits);