mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 13:44:08 +00:00
perf(web): optimize encodeInto() (#15922)
This commit is contained in:
parent
6154188786
commit
5fe660ecd7
5 changed files with 126 additions and 164 deletions
|
@ -25,6 +25,7 @@
|
|||
TypedArrayPrototypeSubarray,
|
||||
TypedArrayPrototypeSlice,
|
||||
Uint8Array,
|
||||
Uint32Array,
|
||||
} = window.__bootstrap.primordials;
|
||||
|
||||
class TextDecoder {
|
||||
|
@ -199,10 +200,16 @@
|
|||
context: "Argument 2",
|
||||
allowShared: true,
|
||||
});
|
||||
return ops.op_encoding_encode_into(source, destination);
|
||||
ops.op_encoding_encode_into(source, destination, encodeIntoBuf);
|
||||
return {
|
||||
read: encodeIntoBuf[0],
|
||||
written: encodeIntoBuf[1],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const encodeIntoBuf = new Uint32Array(2);
|
||||
|
||||
webidl.configurePrototype(TextEncoder);
|
||||
const TextEncoderPrototype = TextEncoder.prototype;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue