diff --git a/frontend/app/utils/bench.ts b/frontend/app/utils/bench.ts new file mode 100644 index 00000000..41a74fe1 --- /dev/null +++ b/frontend/app/utils/bench.ts @@ -0,0 +1,8 @@ +export function bench(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; +}