Skip to content

Commit

Permalink
perf(ksuid): update .parse()
Browse files Browse the repository at this point in the history
- avoid allocation
  • Loading branch information
postspectacular committed Aug 12, 2023
1 parent 6960ebd commit da6765d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/ksuid/src/ksuid32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class KSUID32 extends AKSUID {
}

parse(id: string) {
const buf = new Uint8Array(this.size);
const buf = this.tmp;
this.base.decodeBytes(id, buf);
return {
epoch: this.u32(buf) * 1000 + this.epoch,
Expand Down
2 changes: 1 addition & 1 deletion packages/ksuid/src/ksuid64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class KSUID64 extends AKSUID {
}

parse(id: string) {
const buf = new Uint8Array(this.size);
const buf = this.tmp;
this.base.decodeBytes(id, buf);
return {
epoch:
Expand Down

0 comments on commit da6765d

Please sign in to comment.