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): eliminate duplicate string scanning and StringBuffer allocations in stripJsonc #1360
In lib/core/theme/parser/jsonc_preprocessor.dart (lines 11–15, 57–90):
if (ch =='"') {
out.write(_copyStringLiteral(input, i));
i =_skipStringLiteral(input, i);
continue;
}
When encountering a quote ("):
_copyStringLiteral(input, i) iterates character-by-character through input, writing to an intermediate StringBuffer and returning a new String.
Immediately after, _skipStringLiteral(input, i) scans the exact same characters in input a second time to determine the ending offset.
For VS Code themes containing thousands of tokens and hex color strings (50–150 KB JSONC files), this doubles character scanning work and creates thousands of short-lived StringBuffer and String allocations during theme parsing.
Proposed Solution
Find the closing quote of a string literal in a single scan pass.
Directly write the slice out.write(input.substring(start, end)) to avoid creating intermediate StringBuffer instances for each string literal.
Acceptance Criteria
String literals in JSONC are scanned in a single pass without redundant character loops.
Theme JSONC parsing is faster with reduced GC allocations.
Activity
ZhuchkaTriplesix commentedon Oct 11, 2026
Done in #1400 (merged into
dev).