add bench util
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
export function bench<T>(fn: () => T, label: string = 'bench'): T {
|
||||
const d = performance.now();
|
||||
const r = fn();
|
||||
const dd = performance.now();
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(label, dd - d);
|
||||
return r;
|
||||
}
|
||||
Reference in New Issue
Block a user