Skip to content

Commit a0c23f6

Browse files
committed
lib: use <array>.push instead of <array>.concat
Using `push` and `unshift` methods is more performant than reassigning a new array created with `concat`.
1 parent 2e769a9 commit a0c23f6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/_http_common.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
'use strict';
2323

2424
const {
25-
ArrayPrototypeConcat,
25+
ArrayPrototypePushApply,
2626
MathMin,
2727
Symbol,
2828
RegExpPrototypeTest,
@@ -66,7 +66,7 @@ function parserOnHeaders(headers, url) {
6666
// Once we exceeded headers limit - stop collecting them
6767
if (this.maxHeaderPairs <= 0 ||
6868
this._headers.length < this.maxHeaderPairs) {
69-
this._headers = ArrayPrototypeConcat(this._headers, headers);
69+
ArrayPrototypePushApply(this._headers, headers);
7070
}
7171
this._url += url;
7272
}

lib/internal/main/worker_thread.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// message port.
55

66
const {
7-
ArrayPrototypeConcat,
7+
ArrayPrototypePushApply,
88
ArrayPrototypeSplice,
99
ObjectDefineProperty,
1010
PromisePrototypeCatch,
@@ -125,7 +125,7 @@ port.on('message', (message) => {
125125
loadPreloadModules();
126126
initializeFrozenIntrinsics();
127127
if (argv !== undefined) {
128-
process.argv = ArrayPrototypeConcat(process.argv, argv);
128+
ArrayPrototypePushApply(process.argv, argv);
129129
}
130130
publicWorker.parentPort = publicPort;
131131
publicWorker.workerData = workerData;

0 commit comments

Comments
 (0)