summaryrefslogtreecommitdiff
path: root/ext/fetch/22_body.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2021-09-26 20:40:16 +0200
committerGitHub <noreply@github.com>2021-09-26 20:40:16 +0200
commit7f2976b3e6e227bb031cff4dcc5a55f51e0b1656 (patch)
treeafebdfc05d827865fe465500095a24731bc521c5 /ext/fetch/22_body.js
parent2b6f8d01877a1bceb0910396425f1ee04c8b0fa2 (diff)
perf(fetch): optimize InnerBody constructor (#12232)
Avoid initializers due to overhead
Diffstat (limited to 'ext/fetch/22_body.js')
-rw-r--r--ext/fetch/22_body.js12
1 files changed, 5 insertions, 7 deletions
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<Uint8Array> | { body: Uint8Array, consumed: boolean }} */
- streamOrStatic;
- /** @type {null | Uint8Array | Blob | FormData} */
- source = null;
- /** @type {null | number} */
- length = null;
-
/**
* @param {ReadableStream<Uint8Array> | { body: Uint8Array, consumed: boolean }} stream
*/
constructor(stream) {
+ /** @type {ReadableStream<Uint8Array> | { 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() {