rrrene / credo

A static code analysis tool for the Elixir language with a focus on code consistency and teaching.
http://credo-ci.org/
MIT License
4.91k stars 415 forks source link

Cache scope priorities #1071

Closed sasa1977 closed 9 months ago

sasa1977 commented 1 year ago

Currently, every call to format_issue recalculates the scope priorities. This significantly hurts performance when many issues are reported.

This change adds another ETS table (following the present cache design) to lazily cache these prios. On a large project with almost 7000 issues, this brings the running time of mix credo from 26 seconds to 10 seconds.

Obviously there's more room for improvement, but I think this gain is already significant, and the change is simple enough to be merged on its own. Time-permitting I'll investigate further, but I can't make any promises.

sasa1977 commented 9 months ago

Hey, it's been a while since I've created this PR, so I'm pinging to check if could I get some feedback on this?

rrrene commented 9 months ago

@sasa1977 Crap, I remember looking at this and being excited to merge this ... sorry I missed this, it looks great!

Will publish an RC with some other patches shortly :+1:

rrrene commented 9 months ago

@sasa1977 This is published as part of v1.7.2-rc.2.