mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
lib: use <array>.push and <array>.unshift instead of <array>.concat
Using `push` and `unshift` methods is more performant than reassigning a new array created with `concat`. PR-URL: https://github.com/nodejs/node/pull/37239 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
f392ac0bbe
commit
83cce8717f
3 changed files with 8 additions and 7 deletions
|
@ -22,7 +22,7 @@
|
|||
'use strict';
|
||||
|
||||
const {
|
||||
ArrayPrototypeConcat,
|
||||
ArrayPrototypePushApply,
|
||||
MathMin,
|
||||
Symbol,
|
||||
RegExpPrototypeTest,
|
||||
|
@ -66,7 +66,7 @@ function parserOnHeaders(headers, url) {
|
|||
// Once we exceeded headers limit - stop collecting them
|
||||
if (this.maxHeaderPairs <= 0 ||
|
||||
this._headers.length < this.maxHeaderPairs) {
|
||||
this._headers = ArrayPrototypeConcat(this._headers, headers);
|
||||
ArrayPrototypePushApply(this._headers, headers);
|
||||
}
|
||||
this._url += url;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue