Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmarking support to find low-hanging optimizations? #443

Open
jschaf opened this issue Nov 28, 2024 · 1 comment
Open

Benchmarking support to find low-hanging optimizations? #443

jschaf opened this issue Nov 28, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@jschaf
Copy link

jschaf commented Nov 28, 2024

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
@yoheimuta
Copy link
Owner

@jschaf Thank you for the profiling insights!
I agree that there's room for improvement in protolint's processing speed.

The current implementation prioritizes ease of development over efficiency, so this result is understandable.
On reflection, this line could be a potential culprit, as it results in protolint parsing the same file repeatedly for each rule application.

@yoheimuta yoheimuta pinned this issue Dec 8, 2024
@yoheimuta yoheimuta unpinned this issue Dec 8, 2024
@yoheimuta yoheimuta added the enhancement New feature or request label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants