Skip to content

Commit be5383d

Browse files
committed
perf(tl-pack): use subarray for checksum instead slice
1 parent 5af36d2 commit be5383d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/tl-pack/src/BinaryReader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ export class BinaryReader {
534534
this.assertConstructor(CORE_TYPES.Checksum);
535535
}
536536

537-
const bytes = this.target.slice(this._checksumOffset, offset);
537+
const bytes = this.target.subarray(this._checksumOffset, offset);
538538
const checksum = this.readInt32();
539539
let sum = 0;
540540

packages/tl-pack/src/BinaryWriter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export class BinaryWriter {
264264
}
265265

266266
writeChecksum(withConstructor: boolean = true): this {
267-
const bytes = this.target.slice(this.offsetChecksum, this.offset);
267+
const bytes = this.target.subarray(this.offsetChecksum, this.offset);
268268
let sum = 0;
269269

270270
for (const val of bytes) {

0 commit comments

Comments
 (0)