From 57e41364d9b027e9e934eb5b3c37fa320ffc2695 Mon Sep 17 00:00:00 2001 From: yigencong Date: Sun, 25 Feb 2024 16:27:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20measurecTime=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/index.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/index.mjs b/util/index.mjs index 3868ef2..c295907 100644 --- a/util/index.mjs +++ b/util/index.mjs @@ -59,7 +59,7 @@ export function swap(array, a, b) { const startTime = performance.now(); // 执行传入的函数,使用 apply 或 call 传入参数 - func(...args); + const result = func(...args); // 计算函数执行所花费的时间 const endTime = performance.now(); @@ -67,6 +67,7 @@ export function swap(array, a, b) { // 打印执行时间 console.log(`Function execution time: ${elapsedTime} milliseconds`); + return result }