diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2022-09-17 16:48:15 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-17 16:48:15 +0530 |
commit | 5fe660ecd76fe164c2065bea00fbba49d39553c2 (patch) | |
tree | 5a8c718e9e685e335a5720eca6d37bf5a44531f6 /ext/web/08_text_encoding.js | |
parent | 6154188786108b253e8c775f728783e9ffa5293f (diff) |
perf(web): optimize encodeInto() (#15922)
Diffstat (limited to 'ext/web/08_text_encoding.js')
-rw-r--r-- | ext/web/08_text_encoding.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/web/08_text_encoding.js b/ext/web/08_text_encoding.js index 9e0c1f311..db724033f 100644 --- a/ext/web/08_text_encoding.js +++ b/ext/web/08_text_encoding.js @@ -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; |