Skip to content

Commit d9f2770

Browse files
committed
stream: remove LazyTransform
No longer necessary given recent stream and event optimziations. Refs: nodejs#50428 Refs: nodejs#50439 PR-URL: nodejs#50440
1 parent 4ddb263 commit d9f2770

File tree

5 files changed

+29
-67
lines changed

5 files changed

+29
-67
lines changed
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Creation benchmark
2+
// creates a single hasher, then pushes a minimal data through it
3+
'use strict';
4+
const common = require('../common.js');
5+
const crypto = require('crypto');
6+
7+
const bench = common.createBenchmark(main, {
8+
n: [10e3],
9+
algo: ['md5' ],
10+
});
11+
12+
const buf = Buffer.alloc(4);
13+
14+
function main({ algo, n }) {
15+
bench.start();
16+
for (let i = 0; i < n; ++i) {
17+
const h = crypto.createHash(algo);
18+
h.end(buf)
19+
}
20+
bench.end(n);
21+
}
22+

lib/internal/crypto/cipher.js

-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ const {
5656

5757
const assert = require('internal/assert');
5858

59-
const LazyTransform = require('internal/streams/lazy_transform');
60-
6159
const { normalizeEncoding } = require('internal/util');
6260

6361
const { StringDecoder } = require('string_decoder');

lib/internal/crypto/hash.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const {
5151
isArrayBufferView,
5252
} = require('internal/util/types');
5353

54-
const LazyTransform = require('internal/streams/lazy_transform');
54+
const Transform = require('internal/streams/transform');
5555

5656
const kState = Symbol('kState');
5757
const kFinalized = Symbol('kFinalized');
@@ -69,11 +69,11 @@ function Hash(algorithm, options) {
6969
this[kState] = {
7070
[kFinalized]: false,
7171
};
72-
ReflectApply(LazyTransform, this, [options]);
72+
ReflectApply(Transform, this, [options]);
7373
}
7474

75-
ObjectSetPrototypeOf(Hash.prototype, LazyTransform.prototype);
76-
ObjectSetPrototypeOf(Hash, LazyTransform);
75+
ObjectSetPrototypeOf(Hash.prototype, Transform.prototype);
76+
ObjectSetPrototypeOf(Hash, Transform);
7777

7878
Hash.prototype.copy = function copy(options) {
7979
const state = this[kState];
@@ -133,11 +133,11 @@ function Hmac(hmac, key, options) {
133133
this[kState] = {
134134
[kFinalized]: false,
135135
};
136-
ReflectApply(LazyTransform, this, [options]);
136+
ReflectApply(Transform, this, [options]);
137137
}
138138

139-
ObjectSetPrototypeOf(Hmac.prototype, LazyTransform.prototype);
140-
ObjectSetPrototypeOf(Hmac, LazyTransform);
139+
ObjectSetPrototypeOf(Hmac.prototype, Transform.prototype);
140+
ObjectSetPrototypeOf(Hmac, Transform);
141141

142142
Hmac.prototype.update = Hash.prototype.update;
143143

lib/internal/streams/lazy_transform.js

-57
This file was deleted.

src/node_builtins.cc

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ BuiltinLoader::BuiltinCategories BuiltinLoader::GetBuiltinCategories() const {
125125
"internal/tls/parse-cert-string", "internal/tls/secure-context",
126126
"internal/http2/core", "internal/http2/compat",
127127
"internal/policy/manifest", "internal/process/policy",
128-
"internal/streams/lazy_transform",
129128
#endif // !HAVE_OPENSSL
130129
"sys", // Deprecated.
131130
"wasi", // Experimental.

0 commit comments

Comments
 (0)