woshiccm / Pecker

CodePecker is a tool to detect unused Swift code.
MIT License
1.46k stars 63 forks source link

improve code performance #50

Closed JohnReeze closed 4 years ago

JohnReeze commented 4 years ago

Hello, @woshiccm and thanks for your great work!

I have run pecker for one very big project (about 16k of source elements classes, funcs etc) and for my mac mini (Mac mini (2018) 3 GHz Intel Core i5 16 ГБ 2667 MHz DDR4) it took 147 seconds to process and it found 300 warnings (about 1-2% of them false positive – but still it is an incredible result!).

But I thought that there may be something to optimize. And after researching pecker execution with Time Profiler I found some long-time methods and improved them. Then I run pecker for same configs and project and it took 34.9 seconds (and 300 same warnings).

In this 35 seconds – 95% of time takes 16k times .forEachCanonicalSymbolOccurrence execution which is implemented in IndexStoreDB. (not sure if there is something that we can do with it)

woshiccm commented 4 years ago

Good job, thanks, looking forward to your more contribution