打印某个函数运行时间
方法函数
打印时间记录关键 key
logRunTime(() => [1, 2, 3].reduce(...));logRunTime(() => [1, 2, 3].reduce(...), 'timeKey');logRunTime(async () => { await fun1(); await fun2(); });logRunTime($promiseReturnFunction);logRunTime(new Promise((resolve, reject) => { setTimeout(() => resolve('test'), 1000) })); Copy
logRunTime(() => [1, 2, 3].reduce(...));logRunTime(() => [1, 2, 3].reduce(...), 'timeKey');logRunTime(async () => { await fun1(); await fun2(); });logRunTime($promiseReturnFunction);logRunTime(new Promise((resolve, reject) => { setTimeout(() => resolve('test'), 1000) }));
打印某个函数运行时间