debug: Remove print_elapsed_time in favor of console.time.

https://developer.mozilla.org/en-US/docs/Web/API/console#timers

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-05-11 14:02:31 -07:00 committed by Tim Abbott
parent da2c1ad839
commit 5173511e77
1 changed files with 0 additions and 14 deletions

View File

@ -4,26 +4,12 @@
// the browser console, run: // the browser console, run:
// var debug = require("./src/debug"); // var debug = require("./src/debug");
/*
debug.print_elapsed_time("foo", foo)
evaluates to foo() and prints the elapsed time
to the console along with the name "foo". */
type Collision = { type Collision = {
id: string; id: string;
count: number; count: number;
node: string; node: string;
}; };
export function print_elapsed_time<T>(name: string, fun: () => T): T {
const t0 = Date.now();
const out = fun();
const t1 = Date.now();
console.log(`${name} : ${t1 - t0} ms`);
return out;
}
export function check_duplicate_ids(): {collisions: Collision[]; total_collisions: number} { export function check_duplicate_ids(): {collisions: Collision[]; total_collisions: number} {
const ids = new Set<string>(); const ids = new Set<string>();
const collisions: Collision[] = []; const collisions: Collision[] = [];