Skip to content

Conversation

@texodus
Copy link
Member

@texodus texodus commented Jan 19, 2026

This PR adds a benchmark suite which measures scroll performance, and some modest performance improvements to the library itself (guided by said benchmarks).

  • Modified CSS stylesheet to use setProperty to update fields on the CSSRule rather than regeenerating the entire sheet.
  • Check if CSS has changed before applying.
  • Removed reduce/map/etc calls where we can save an allocation.
  • Modified some code to avoid iterating children where possible (to avoid the HTMLCollection overhead).

Before:

Test Throughput (fps) Avg Frame (ms) CPU % Layout (ms) Layout # Style (ms) Style #
Scroll Right 37.43 26.71 100.0 2,948.63 930 585.73 1,130
Draw 271.38 3.68 94.0 101.89 200 129.72 200

After:

Test Throughput (fps) Avg Frame (ms) CPU % Layout (ms) Layout # Style (ms) Style #
Scroll Right 43.50 22.98 100.1 2,433.02 835 660.50 855
Draw 352.48 2.84 94.9 82.56 200 111.35 200

@texodus texodus added the internal Internal refactoring and code quality improvement label Jan 19, 2026
@texodus texodus marked this pull request as ready for review January 19, 2026 18:11
@texodus texodus merged commit 4558a4a into master Jan 19, 2026
2 checks passed
@timkpaine timkpaine deleted the benchmarks branch January 22, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Internal refactoring and code quality improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants