Skip to content

Commit a08039e

Browse files
committed
withTiming function
1 parent db0f9a5 commit a08039e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/core/performance.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
*
66
*/
77

8+
export function withTiming<T>(label: string, op: () => T) {
9+
console.time(label);
10+
try {
11+
return op();
12+
} finally {
13+
console.timeEnd(label);
14+
}
15+
}
16+
817
export function performanceStart() {
918
performanceClear();
1019
}

0 commit comments

Comments
 (0)