MCPcopy Index your code
hub / github.com/angular/angular / profile

Function profile

modules/benchmarks/src/util.ts:40–58  ·  view source on GitHub ↗
(create: () => void, destroy: () => void, name: string)

Source from the content-addressed store, hash-verified

38}
39
40export function profile(create: () => void, destroy: () => void, name: string) {
41 return function () {
42 // 'console.profile' is experimental and was removed from DOM lib in TS 3.9
43 (window.console as any).profile(name);
44 const noOfRuns = 150;
45 let durations: number[] = [];
46 let count = 0;
47 while (count++ < noOfRuns) {
48 const start = window.performance.now();
49 create();
50 const end = window.performance.now() - start;
51 durations.push(end);
52 destroy();
53 }
54 // 'console.profileEnd' is experimental and was removed from DOM lib in TS 3.9
55 (window.console as any).profileEnd();
56 reportProfileResults(durations, noOfRuns);
57 };
58}
59
60function reportProfileResults(durations: number[], count: number) {
61 const totalDuration = durations.reduce((soFar: number, duration: number) => soFar + duration, 0);

Callers 12

initFunction · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.90

Calls 5

reportProfileResultsFunction · 0.85
profileMethod · 0.80
createFunction · 0.50
destroyFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…