With @property
now being Baseline Newly Available, I thought it’d be a good time benchmark the impact – if any – it has on the performance of your CSS.
When starting to use a new CSS feature it’s important to understand its impact on the performance of your websites, whether positive or negative. With
@property
now in Baseline this post explores its performance impact, and things you can do to help prevent negative impact.
For this I built and open sourced the “CSS Selector Benchmark” project which I have been working on for some time now.
To benchmark the performance of CSS we built the “CSS Selector Benchmark” test suite. It is powered by Chromium’s
PerfTestRunner
and benchmarks the performance impact of CSS. ThisPerfTestRunner
is what Blink (= Chromium’s underlying rendering engine) uses for its internal performance tests.The runner includes a
measureRunsPerSecond
method which is used for the tests. The higher the number of runs per second, the better.
The created benchmarks for @property
specifically measure how fast Blink can handle a Style Invalidation and the subsequent Recalculate Style task. This was tested with both registered and unregistered custom properties, as well as regular properties.
Read “Benchmarking the performance of CSS @property
” on web.dev →
Check out “css-selector-benchmark
” on GitHub →