MCPcopy
hub / github.com/ReactTooltip/react-tooltip / runScalingBenchmark

Function runScalingBenchmark

benchmarks/fixture/app.tsx:164–299  ·  view source on GitHub ↗
({
  version,
  counts,
  timeoutMs,
  repeats,
  warmups,
  renderMode,
  onProgress,
}: {
  version: BenchmarkVersion
  counts: number[]
  timeoutMs: number
  repeats: number
  warmups: number
  renderMode: RenderMode
  onProgress?: (message: string) => void
})

Source from the content-addressed store, hash-verified

162}
163
164async 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()

Callers

nothing calls this directly

Calls 6

renderFixtureFunction · 0.85
nextFrameFunction · 0.85
waitUntilFunction · 0.85
unmountFixtureFunction · 0.85
collectGarbageFunction · 0.85
readUsedHeapBytesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…