Skip to content

TP-14 — Add LRU cache for parsed themes #109

Description

@ZhuchkaTriplesix

Epic: B
Depends on: TP-13

Source: docs/theme-parser-github-issues.md

Goal

Avoid repeated file reads and parsing when switching between themes.

Files

  • lib/core/theme/theme_registry_service.dart
  • test/core/theme/theme_registry_cache_test.dart

Implementation

Inside ThemeRegistryService:

  • cache QueryaTheme by definition.stableCacheKey;
  • max entries: 12 or 20;
  • on cache hit, return cached theme;
  • on content hash change, key changes naturally;
  • expose clearCache() for tests/reset.

If current project has no LRU helper, implement tiny private LRU using LinkedHashMap.

Acceptance Criteria

  • Loading same definition twice parses once.
  • Loading changed file parses again.
  • Cache evicts oldest entry after limit.

Tests

  • fake parser counter or temp file mutation;
  • cache hit;
  • cache invalidation by hash;
  • eviction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceTheme parser epic label: performanceregistryTheme parser epic label: registrythemeTheming, colors, VS Code themes

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions