Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 878b2e7

Browse filesBrowse files
TrottBethGriggs
authored andcommitted
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: #41535 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent be63dc5 commit 878b2e7
Copy full SHA for 878b2e7

File tree

Expand file treeCollapse file tree

1 file changed

+1
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-5
lines changed
Open diff view settings
Collapse file

‎benchmark/crypto/hash-stream-creation.js‎

Copy file name to clipboardExpand all lines: benchmark/crypto/hash-stream-creation.js
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ function legacyWrite(algo, message, encoding, writes, len, outEnc) {
5252
while (writes-- > 0) {
5353
const h = crypto.createHash(algo);
5454
h.update(message, encoding);
55-
let res = h.digest(outEnc);
56-
57-
// Include buffer creation costs for older versions
58-
if (outEnc === 'buffer' && typeof res === 'string')
59-
res = Buffer.from(res, 'binary');
55+
h.digest(outEnc);
6056
}
6157

6258
bench.end(gbits);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.