From a9e4176d117f6d89ca534b56511c412802ea296a Mon Sep 17 00:00:00 2001 From: yasuaki640 Date: Tue, 25 Jun 2024 06:18:37 +0900 Subject: [PATCH] perf(utils/buffer): use promise all for better performance (#3031) --- src/utils/buffer.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils/buffer.ts b/src/utils/buffer.ts index cde4c789..b8ead4ee 100644 --- a/src/utils/buffer.ts +++ b/src/utils/buffer.ts @@ -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