Conversation
…ld perf The Theme.applyStyleToString() method emitted a DEBUG print() for every token whose style class is absent from the theme. Unstyled classes (eg. hljs-operator under atom-one-light/dark) are normal theming behaviour, so this fired thousands of times per highlighting pass, spamming the console and noticeably slowing Debug-mode highlighting. Gate the warning behind a new opt-in Theme.logsMissingStyles flag (default false). Document it in the README and CHANGELOG, and bump the version to 3.1.1. Claude-Session: https://claude.ai/code/session_01URhepimagEqZ2kCNzyQcYU Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Theme.applyStyleToString()emitted a#if DEBUGprint()for every token whose style class is absent from the theme. Unstyled classes are normal theming behaviour — e.g.hljs-operatorintentionally inherits the default colour underatom-one-light/atom-one-dark— so this fired thousands of times per highlighting pass (~5,585 prints / ~167ms in the reported case), spamming the console and noticeably degrading Debug-mode highlighting performance.This implements: gate the warning behind an opt-in flag rather than removing it, so the diagnostic is still available when developing a custom theme.
Changes
public var logsMissingStyles: Bool = falsetoTheme.WARNING MISSING STYLE…print whenlogsMissingStylesistrue(still#if DEBUG-gated, so Release builds are unchanged).Usage
Closes #8.
🤖 Generated with Claude Code