MCPcopy Create free account
hub / github.com/ReactTooltip/react-tooltip / main

Function main

benchmarks/run-benchmark.mjs:177–408  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

175}
176
177async function main() {
178 logProgress('Preparing benchmark bundle')
179 await rm(cacheDir, { recursive: true, force: true })
180 await mkdir(resultsDir, { recursive: true })
181 await ensureFixtureBundle()
182 logProgress('Launching headless Chrome')
183
184 const launchOptions = {
185 headless: true,
186 args: [
187 '--enable-precise-memory-info',
188 '--js-flags=--expose-gc',
189 // Reduce OS/browser noise
190 '--disable-background-networking',
191 '--disable-background-timer-throttling',
192 '--disable-backgrounding-occluded-windows',
193 '--disable-renderer-backgrounding',
194 '--disable-ipc-flooding-protection',
195 '--disable-hang-monitor',
196 '--disable-extensions',
197 '--no-sandbox',
198 ],
199 }
200 if (executablePath) {
201 launchOptions.executablePath = executablePath
202 }
203
204 const browser = await chromium.launch(launchOptions)
205
206 try {
207 const fixtureBundleContent = await readFile(fixtureBundlePath, 'utf8')
208
209 async function createBenchmarkPage() {
210 const page = await browser.newPage()
211 page.on('console', (message) => {
212 const text = message.text()
213 if (text.includes('Download the React DevTools')) {
214 return
215 }
216 console.log(`[page:${message.type()}] ${text}`)
217 })
218 page.on('pageerror', (error) => {
219 console.error(`[pageerror] ${error.message}`)
220 })
221
222 await page.goto(pathToFileURL(cacheHtmlPath).toString(), {
223 waitUntil: 'networkidle',
224 })
225 await page.addScriptTag({ content: fixtureBundleContent })
226 await page.waitForFunction(() => Boolean(window.__reactTooltipBenchmark), null, {
227 timeout: timeoutMs,
228 })
229 return page
230 }
231
232 logProgress(`Running scaling benchmark for counts: ${counts.join(', ')}`)
233
234 const runVersion = async (version) => {

Callers 1

run-benchmark.mjsFile · 0.70

Calls 7

logProgressFunction · 0.85
ensureFixtureBundleFunction · 0.85
runVersionFunction · 0.85
aggregateVersionFunction · 0.70
timestampIdFunction · 0.70
aggregateNumbersFunction · 0.70
buildMarkdownReportFunction · 0.70

Tested by

no test coverage detected