8000 analysis/lint: avoid rendering Markdown docs at init by javabetatester · Pull Request #1854 · dominikh/go-tools · GitHub
[go: up one dir, main page]

Skip to content

analysis/lint: avoid rendering Markdown docs at init - #1854

Open
javabetatester wants to merge 1 commit into
dominikh:masterfrom
javabetatester:analysis-lint-init-docs
Open

javabetatester wants to merge 1 commit into
dominikh:masterfrom
javabetatester:analysis-lint-init-docs

Conversation

@javabetatester
Copy link
Copy Markdown

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0