From 7f2976b3e6e227bb031cff4dcc5a55f51e0b1656 Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Sun, 26 Sep 2021 20:40:16 +0200 Subject: perf(fetch): optimize InnerBody constructor (#12232) Avoid initializers due to overhead --- ext/fetch/22_body.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'ext/fetch') diff --git a/ext/fetch/22_body.js b/ext/fetch/22_body.js index acbef4ec4..c9702488c 100644 --- a/ext/fetch/22_body.js +++ b/ext/fetch/22_body.js @@ -36,19 +36,17 @@ } = window.__bootstrap.primordials; class InnerBody { - /** @type {ReadableStream | { body: Uint8Array, consumed: boolean }} */ - streamOrStatic; - /** @type {null | Uint8Array | Blob | FormData} */ - source = null; - /** @type {null | number} */ - length = null; - /** * @param {ReadableStream | { body: Uint8Array, consumed: boolean }} stream */ constructor(stream) { + /** @type {ReadableStream | { body: Uint8Array, consumed: boolean }} */ this.streamOrStatic = stream ?? { body: new Uint8Array(), consumed: false }; + /** @type {null | Uint8Array | Blob | FormData} */ + this.source = null; + /** @type {null | number} */ + this.length = null; } get stream() { -- cgit v1.2.3