({
version,
counts,
timeoutMs,
repeats,
warmups,
renderMode,
onProgress,
}: {
version: BenchmarkVersion
counts: number[]
timeoutMs: number
repeats: number
warmups: number
renderMode: RenderMode
onProgress?: (message: string) => void
})
| 162 | } |
| 163 | |
| 164 | async function runScalingBenchmark({ |
| 165 | version, |
| 166 | counts, |
| 167 | timeoutMs, |
| 168 | repeats, |
| 169 | warmups, |
| 170 | renderMode, |
| 171 | onProgress, |
| 172 | }: { |
| 173 | version: BenchmarkVersion |
| 174 | counts: number[] |
| 175 | timeoutMs: number |
| 176 | repeats: number |
| 177 | warmups: number |
| 178 | renderMode: RenderMode |
| 179 | onProgress?: (message: string) => void |
| 180 | }): Promise<ScenarioResult> { |
| 181 | const samplesByCount: ScenarioSample[] = [] |
| 182 | |
| 183 | for (const count of counts) { |
| 184 | // Scale warmups for large counts to ensure JIT is fully warm |
| 185 | const effectiveWarmups = count >= 10000 ? Math.max(warmups, 2) : warmups |
| 186 | |
| 187 | for (let warmupIndex = 0; warmupIndex < effectiveWarmups; warmupIndex += 1) { |
| 188 | onProgress?.(`count=${count} warmup ${warmupIndex + 1}/${effectiveWarmups}`) |
| 189 | await renderFixture({ |
| 190 | version, |
| 191 | count: 0, |
| 192 | renderMode, |
| 193 | }) |
| 194 | await nextFrame() |
| 195 | await renderFixture({ |
| 196 | version, |
| 197 | count, |
| 198 | renderMode, |
| 199 | }) |
| 200 | await waitUntil( |
| 201 | () => document.querySelectorAll('[data-tooltip-id]').length === count, |
| 202 | timeoutMs, |
| 203 | ) |
| 204 | await nextFrame() |
| 205 | await unmountFixture() |
| 206 | await nextFrame() |
| 207 | } |
| 208 | |
| 209 | for (let repeatIndex = 0; repeatIndex < repeats; repeatIndex += 1) { |
| 210 | onProgress?.(`count=${count} repeat ${repeatIndex + 1}/${repeats}`) |
| 211 | await renderFixture({ |
| 212 | version, |
| 213 | count: 0, |
| 214 | renderMode, |
| 215 | }) |
| 216 | await nextFrame() |
| 217 | |
| 218 | // Settle memory before mount measurement |
| 219 | await collectGarbage() |
| 220 | const mountMemoryBefore = readUsedHeapBytes() |
| 221 | const mountStartedAt = window.performance.now() |
nothing calls this directly
no test coverage detected
searching dependent graphs…