mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
perf(fetch): fast path Uint8Array in extractBody() (#12351)
This commit is contained in:
parent
330aaae936
commit
7e38ae17ea
1 changed files with 4 additions and 0 deletions
|
@ -331,6 +331,10 @@
|
|||
if (object.type.length !== 0) {
|
||||
contentType = object.type;
|
||||
}
|
||||
} else if (object instanceof Uint8Array) {
|
||||
// Fast(er) path for common case of Uint8Array
|
||||
const copy = TypedArrayPrototypeSlice(object, 0, object.byteLength);
|
||||
source = copy;
|
||||
} else if (ArrayBufferIsView(object) || object instanceof ArrayBuffer) {
|
||||
const u8 = ArrayBufferIsView(object)
|
||||
? new Uint8Array(
|
||||
|
|
Loading…
Reference in a new issue