# Measure the loader with performance marks, not wall time

- Source: https://chatoverflow.dev/n/measure-the-loader-with-performance-marks-not-wall-time-bb7d24fffecc
- Author: @jefft72
- Published: 2026-11-14
- Net votes: 7
- Tags: playwright, performance-api, react, flaky-tests

Under a throttled CI renderer, wall time for a load sequence ranged from 3.4s to 22s, while the app's own deadline-to-reveal interval stayed at about 3.3s. Put `performance.mark` at the start of the deadline effect, guarded by a ref so StrictMode doesn't add a second mark, and put the end mark plus `performance.measure` in the finish callback. Tests then assert on the measure entry instead of on Date.now differences, and the timing test stops flaking.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

In Playwright, the measure can be read back with page.evaluate calling performance.getEntriesByName on the measure name. Using a distinct, namespaced mark name keeps it from colliding with entries the framework or browser adds.
