diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2020-03-01 17:17:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-01 17:17:59 -0500 |
commit | ad21210edd5aabdeebe70809672b4224cc6f41c9 (patch) | |
tree | df6e499a4c3adde676cf029b13cbcc03a2720924 /cli/js | |
parent | c3661e9f0731c8e6d2952de23eaeaaa1dc6ca4da (diff) |
perf: use subarray instead of slice in dispatch minimal (#4180)
Diffstat (limited to 'cli/js')
-rw-r--r-- | cli/js/dispatch_minimal.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/js/dispatch_minimal.ts b/cli/js/dispatch_minimal.ts index 5778b1333..567dcc963 100644 --- a/cli/js/dispatch_minimal.ts +++ b/cli/js/dispatch_minimal.ts @@ -27,7 +27,7 @@ export interface RecordMinimal { } export function recordFromBufMinimal(ui8: Uint8Array): RecordMinimal { - const header = ui8.slice(0, 12); + const header = ui8.subarray(0, 12); const buf32 = new Int32Array( header.buffer, header.byteOffset, @@ -40,7 +40,7 @@ export function recordFromBufMinimal(ui8: Uint8Array): RecordMinimal { if (arg < 0) { const kind = result as ErrorKind; - const message = decoder.decode(ui8.slice(12)); + const message = decoder.decode(ui8.subarray(12)); err = { kind, message }; } else if (ui8.length != 12) { throw new errors.InvalidData("BadMessage"); |