protolint icon indicating copy to clipboard operation
protolint copied to clipboard

Benchmarking support to find low-hanging optimizations?

Open jschaf opened this issue 11 months ago • 1 comments

Happy Thanksgiving! In the spirit, thank you for this wonderful linting tool.

How might I go about benchmarking protolint to improve the speed? I have 130 proto files, totaling 31 kLOC, and it takes about 3.4 seconds for protolint to check them. That means:

  • protolint parses about 9 kLOC/second.

By comparison, Go compiles at about 44 kLOC/second, so I suspect there are opportunities to improve the parsing speed.

I'm interested because protolint is the slowest lint I've added to our repo by about 2x. I want to improve interactive performance for a better dev experience.

Here's the trace showing the performance of various lints:

Screenshot 2024-11-28 at 3 13 08 PM

I did a bit of profiling by adding pprof locally to protolint but didn't find anything conclusive. The majority of time is spent parsing. The rule execution only accounts for 2% of the time.

Screenshot 2024-11-28 at 3 15 34 PM

jschaf avatar Nov 28 '24 23:11 jschaf