MCPcopy
hub / github.com/sindresorhus/p-queue / addBenchmark

Function addBenchmark

bench.ts:19–32  ·  view source on GitHub ↗
(name: string, fn: () => Promise<void>)

Source from the content-addressed store, hash-verified

17 || selectedBenchmarks.some(selectedBenchmark => name.includes(selectedBenchmark));
18
19const addBenchmark = (name: string, fn: () => Promise<void>) => {
20 if (!shouldRunBenchmark(name)) {
21 return;
22 }
23
24 (suite as any).add(name, {
25 defer: true,
26
27 async fn(deferred: Resolvable) {
28 await fn();
29 deferred.resolve();
30 },
31 });
32};
33
34addBenchmark('baseline', async () => {
35 const queue = new PQueue();

Callers 1

bench.tsFile · 0.85

Calls 2

shouldRunBenchmarkFunction · 0.85
addMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…