perf(ext/web): flatten op arguments for text_encoding (#15723)

This commit is contained in:
Divy Srivastava 2022-09-01 16:21:13 +05:30 committed by GitHub
parent 73b4597dec
commit 0abf5a412b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 47 deletions

View file

@ -125,24 +125,22 @@
}
if (!options.stream && this.#rid === null) {
return ops.op_encoding_decode_single(input, {
label: this.#encoding,
fatal: this.#fatal,
ignoreBom: this.#ignoreBOM,
});
return ops.op_encoding_decode_single(
input,
this.#encoding,
this.#fatal,
this.#ignoreBOM,
);
}
if (this.#rid === null) {
this.#rid = ops.op_encoding_new_decoder({
label: this.#encoding,
fatal: this.#fatal,
ignoreBom: this.#ignoreBOM,
});
this.#rid = ops.op_encoding_new_decoder(
this.#encoding,
this.#fatal,
this.#ignoreBOM,
);
}
return ops.op_encoding_decode(input, {
rid: this.#rid,
stream: options.stream,
});
return ops.op_encoding_decode(input, this.#rid, options.stream);
} finally {
if (!options.stream && this.#rid !== null) {
core.close(this.#rid);