mirror of
https://github.com/denoland/deno.git
synced 2024-12-01 16:51:13 -05:00
perf: use subarray instead of slice in dispatch minimal (#4173)
This commit is contained in:
parent
0a51611d76
commit
0eb91c5591
1 changed files with 2 additions and 2 deletions
|
@ -27,7 +27,7 @@ export interface RecordMinimal {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function recordFromBufMinimal(ui8: Uint8Array): RecordMinimal {
|
export function recordFromBufMinimal(ui8: Uint8Array): RecordMinimal {
|
||||||
const header = ui8.slice(0, 12);
|
const header = ui8.subarray(0, 12);
|
||||||
const buf32 = new Int32Array(
|
const buf32 = new Int32Array(
|
||||||
header.buffer,
|
header.buffer,
|
||||||
header.byteOffset,
|
header.byteOffset,
|
||||||
|
@ -40,7 +40,7 @@ export function recordFromBufMinimal(ui8: Uint8Array): RecordMinimal {
|
||||||
|
|
||||||
if (arg < 0) {
|
if (arg < 0) {
|
||||||
const kind = result as ErrorKind;
|
const kind = result as ErrorKind;
|
||||||
const message = decoder.decode(ui8.slice(12));
|
const message = decoder.decode(ui8.subarray(12));
|
||||||
err = { kind, message };
|
err = { kind, message };
|
||||||
} else if (ui8.length != 12) {
|
} else if (ui8.length != 12) {
|
||||||
throw new errors.InvalidData("BadMessage");
|
throw new errors.InvalidData("BadMessage");
|
||||||
|
|
Loading…
Reference in a new issue