CostReporter.ts is a simple benchmarking tool for the Univer project. It only counts the duration consumed by the steps we focus on.
Run with --workers=1 to avoid performance impact caused by concurrency.
pnpm installrun with ui
pnpm benchmark --uirun with headed
pnpm benchmark --ui --headedrun once
pnpm benchmarkrun n times
pnpm benchmark --repeat-each=3
pnpm benchmark --repeat-each=10run with a regular filter, only run the test with the name contains 'raw load'
pnpm benchmark -g "raw load"test(`new test`, async ({ page }) => {
await page.goto('/');
// wait for the page to be ready or to Pre work
// The internal time of the step named 'timeCost' will only be counted
await test.step('timeCost', async () => {
// do something
})
});- Maybe you need check the
playwright.config.tsfile to see if theprojectsoptions are suitable for your environment. - the timeout of the test is set to 10s, you can change it in the
playwright.config.tsfile.