You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(theme): cache tokenColorsHash on QueryaTheme to eliminate Object.hashAll in QueryaCodeEditor.build() #1353
In lib/core/editor/querya_code_editor.dart (lines 148, 296–298) and lib/core/editor/syntax_highlight_service.dart (lines 63–67):
During every build pass of QueryaCodeEditor: final tokenHash = Object.hashAll(queryaTheme.tokenColors);
In SyntaxHighlightService.createPair: Object.hash(language, queryaTheme.editor, Object.hashAll(queryaTheme.tokenColors))
A full VS Code theme (imported or built-in) typically contains 100–300+ TokenColorRule objects. Calling Object.hashAll on a 300-element list on every build of the code editor (which can trigger on cursor blinking, selection updates, or ancestor rebuilds) iterates through every rule to compute hash codes.
Proposed Solution
Compute and store final int tokenColorsHash once on QueryaTheme during construction/parsing.
Replace Object.hashAll(queryaTheme.tokenColors) in QueryaCodeEditor and SyntaxHighlightService with queryaTheme.tokenColorsHash.
Acceptance Criteria
QueryaTheme caches the precomputed hash of its tokenColors.
QueryaCodeEditor.build() performs an (1)$ integer comparison instead of iterating through all token rules.
Activity
ZhuchkaTriplesix commentedon Oct 11, 2026
Done in #1401 (merged into
dev).