Repository navigation
analysis/lint: avoid rendering Markdown docs at init - #1854
Open
javabetatester wants to merge 1 commit into
Open
javabetatester wants to merge 1 commit into
javabetatester wants to merge 1 commit into
Conversation
InitializeAnalyzer compiled every analyzer's documentation to both plain text and Markdown, but only the plain text is stored in analysis.Analyzer.Doc. Each call also built two new strings.Replacer values, whose lookup tables are rebuilt on first use. Compile only the plain-text fields during initialization and share the two replacers. Analyzer.Doc is unchanged: all 160 analyzers in simple, staticcheck, stylecheck and quickfix produce byte-identical Doc strings. staticcheck -version, perf stat -r 20, one pinned core: instructions 24.48M -> 18.17M (-26%) BenchmarkInitializeAnalyzer (3 docs, count 8): ~15.0 us/op -> ~3.7 us/op, 12259 -> 2416 B/op, 154 -> 44 allocs/op
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.
InitializeAnalyzer compiled every analyzer's documentation to both
plain text and Markdown, but only the plain text is stored in
analysis.Analyzer.Doc. Each call also built two new strings.Replacer
values, whose lookup tables are rebuilt on first use.
Compile only the plain-text fields during initialization and share the
two replacers. Analyzer.Doc is unchanged: all 160 analyzers in simple,
staticcheck, stylecheck and quickfix produce byte-identical Doc strings.
staticcheck -version, perf stat -r 20, one pinned core:
instructions 24.48M -> 18.17M (-26%)
BenchmarkInitializeAnalyzer (3 docs, count 8):
~15.0 us/op -> ~3.7 us/op, 12259 -> 2416 B/op, 154 -> 44 allocs/op