0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 17:34:47 -05:00

perf(fetch): optimize InnerBody constructor (#12232)

Avoid initializers due to overhead
This commit is contained in:
Aaron O'Mullan 2021-09-26 20:40:16 +02:00 committed by GitHub
parent 2b6f8d0187
commit 7f2976b3e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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() {