Skip to content

perf: optimize no-explicit-any reporting - #1635

Merged
fansenze merged 1 commit into
mainfrom
perf/no-explicit-any-20260808
Aug 9, 2026
Merged

fansenze merged 1 commit into
mainfrom
perf/no-explicit-any-20260808

Conversation

@fansenze

@fansenze fansenze commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • defer autofix and suggestion construction until the corresponding edit demand requests it
  • use a validated fixed-width range for the ASCII any keyword, with the scanner-backed range helper as a safe fallback
  • reuse the validated range for plain unknown and never replacements while preserving the parent replacement for keyof any
  • add demand-sensitive, range, fix, suggestion, trivia, and disable-directive coverage

Go benchmark

Package-local benchmarks were run with benchmem under stable idle conditions. This comparison isolates the final validated keyword-range and range-reuse optimization by comparing the deferred-report intermediate implementation with the final implementation.

Case Time before -> after Delta Bytes before -> after Allocs before -> after
Diagnostics only 6665.5 -> 1399.7 ns/op -79.0% 10632 -> 392 B/op 68 -> 4
No matches 234.3 -> 230.4 ns/op -1.7% 392 -> 392 B/op 4 -> 4
Suggestions 25171.6 -> 9432.6 ns/op -62.5% 43912 -> 13192 B/op 452 -> 260
Fix diagnostics only 6705.5 -> 1392.4 ns/op -79.2% 10632 -> 392 B/op 68 -> 4
Autofix 14480.9 -> 4089.2 ns/op -71.8% 23944 -> 3464 B/op 260 -> 132
Ignored rest args 495.4 -> 495.4 ns/op 0.0% 392 -> 392 B/op 4 -> 4
keyof any suggestions 16914.4 -> 12409.6 ns/op -26.6% 28040 -> 17800 B/op 324 -> 260

Validation completed:

  • go test ./internal/plugins/typescript/rules/no_explicit_any -count=3
  • pnpm run check-spell
  • pnpm run format:check
  • changed-package golangci-lint with --new-from-rev=origin/main
  • git diff --check

Related Links

N/A

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@fansenze
fansenze merged commit ad11481 into main Aug 9, 2026
14 checks passed
@fansenze
fansenze deleted the perf/no-explicit-any-20260808 branch August 9, 2026 02:09
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