Skip to content

Commit

Permalink
perf(utils/buffer): use promise all for better performance (#3031)
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuaki640 authored Jun 24, 2024
1 parent a9d5313 commit a9e4176
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/utils/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export const timingSafeEqual = async (
hashFunction = sha256
}

const sa = await hashFunction(a)
const sb = await hashFunction(b)
const [sa, sb] = await Promise.all([hashFunction(a), hashFunction(b)])

if (!sa || !sb) {
return false
Expand Down

0 comments on commit a9e4176

Please sign in to comment.