(label: string)
| 2215 | |
| 2216 | /** Dump this thread's matchReference sub-stage table to stderr (no-op unless =2). */ |
| 2217 | export function dumpNameMatcherProfile(label: string): void { |
| 2218 | if (!NM_PROFILE || NM_PROFILE.size === 0) return; |
| 2219 | const rows = [...NM_PROFILE.entries()] |
| 2220 | .map(([k, v]) => ({ k, n: v.n, ms: Number(v.ns / 1_000_000n) })) |
| 2221 | .sort((a, b) => b.ms - a.ms); |
| 2222 | for (const r of rows) { |
| 2223 | console.error( |
| 2224 | `[resolve-profile] ${label} ${r.k}: n=${r.n} total=${(r.ms / 1000).toFixed(1)}s avg=${((r.ms * 1000) / Math.max(1, r.n)).toFixed(0)}µs` |
| 2225 | ); |
| 2226 | } |
| 2227 | } |
| 2228 | |
| 2229 | export function matchReference( |
| 2230 | ref: UnresolvedRef, |
no test coverage detected