mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 07:44:48 -05:00
51 lines
941 B
TypeScript
51 lines
941 B
TypeScript
|
Deno.bench("start and end", (t) => {
|
||
|
const id = setInterval(() => {}, 1000);
|
||
|
t.start();
|
||
|
Deno.inspect(id);
|
||
|
t.end();
|
||
|
clearInterval(id);
|
||
|
});
|
||
|
|
||
|
Deno.bench("start only", (t) => {
|
||
|
const id = setInterval(() => {}, 1000);
|
||
|
t.start();
|
||
|
Deno.inspect(id);
|
||
|
clearInterval(id);
|
||
|
});
|
||
|
|
||
|
Deno.bench("end only", (t) => {
|
||
|
const id = setInterval(() => {}, 1000);
|
||
|
Deno.inspect(id);
|
||
|
t.end();
|
||
|
clearInterval(id);
|
||
|
});
|
||
|
|
||
|
Deno.bench("double start", (t) => {
|
||
|
const id = setInterval(() => {}, 1000);
|
||
|
t.start();
|
||
|
t.start();
|
||
|
Deno.inspect(id);
|
||
|
t.end();
|
||
|
clearInterval(id);
|
||
|
});
|
||
|
|
||
|
let captured: Deno.BenchContext;
|
||
|
|
||
|
Deno.bench("double end", (t) => {
|
||
|
captured = t;
|
||
|
const id = setInterval(() => {}, 1000);
|
||
|
t.start();
|
||
|
Deno.inspect(id);
|
||
|
t.end();
|
||
|
t.end();
|
||
|
clearInterval(id);
|
||
|
});
|
||
|
|
||
|
Deno.bench("captured", () => {
|
||
|
const id = setInterval(() => {}, 1000);
|
||
|
captured!.start();
|
||
|
Deno.inspect(id);
|
||
|
captured!.end();
|
||
|
clearInterval(id);
|
||
|
});
|