Skip to content

perf(icons): cache tint color resolution#546

Closed
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-icon-tint-color-cache-pr
Closed

perf(icons): cache tint color resolution#546
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-icon-tint-color-cache-pr

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Added bounded caches for CSS tint normalization, validation, parsed RGB values, root CSS variable reads, and readable tint results.
  • Added theme/style invalidation so dark/light switches and root style changes do not leave stale readable colors.
  • Added a focused tint cache regression/measurement harness.

Why

Icon tint and readable-color helpers run during list/grid/accessory rendering. Repeated DOM element creation and computed-style reads are avoidable for repeated static tint colors.

Compatibility impact

  • Preserves named CSS colors, hex normalization, invalid-color handling, object light/dark tint selection, theme changes, and minimum-contrast adjustment.
  • Dynamic CSS expressions such as var(...) are not cached as parsed/readable values, so they keep recomputing like the previous behavior.

Metrics

10k repeated calls on the focused harness:

  • resolveTintColor string: 10,000 element creations before -> 1 after.
  • object light/dark tint: 20,000 element creations before -> 2 after.
  • resolveReadableTintColor: 20,000 element creations and 20,000 getComputedStyle calls before -> 2 and 2 after.

How tested

  • node scripts/test-icon-tint-cache.mjs
  • CLANG_MODULE_CACHE_PATH=/private/tmp/supercmd-clang-module-cache node --test 'scripts/test-*.mjs'
  • LSP diagnostics on edited files: no errors

Stack validation

Clean PR branch created from origin/main and cherry-picked only this fix. No integration-stack dependency.

@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by consolidated upstream PR #555.

@JustYannicc JustYannicc closed this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant