feat: add byte store to improve performance #428
Conversation
@roman-petrov could you run this fix on your codebase just to see how much is the difference now? It should now run faster after first run (actually similarly to |
Codecov Report
@@ Coverage Diff @@
## master #428 +/- ##
==========================================
- Coverage 81.64% 81.36% -0.28%
==========================================
Files 178 177 -1
Lines 3749 3811 +62
==========================================
+ Hits 3061 3101 +40
- Misses 688 710 +22
Continue to review full report at Codecov.
|
@incendial , thank you for all your efforts trying to improve dart code metrics performance! I just finished testing this branch to see if it has better analysis performance compared to After that, I decided to compare dart code metrics performance on the dart code metrics project itself. To make this semi-automatic I created a simple batch script that measures execution time: @echo %time%
@call metrics analyze dart-code-metrics/lib >nul
@echo %time% Before running each test I switched to git branch I need, deactivated dart code metrics globally, and then activated it again from path using Results are as follows: Without optimization, With optimization, Actually, I performed these tests twice, but the results are the same... So unfortunately I observe serious performance regression. not sure if I doing something wrong. Maybe, this is related to Windows somehow. Maybe, the good next step would be if you repeat my test on Windows machine if you have one?... |
@roman-petrov thank you for your help, I think performance is very important so we definitely should address issues like that.
Interesting... I see exactly the opposite (mac os, 24 for master and 16 for this branch) which is very strange. Could you try to find I not sure about cache mechanism working differently for Windows, but let's try to find out. |
I used |
I followed your advice and removed As you see, first run takes more than 4 minutes, timings for subsequent runs are not changed (still ~23 seconds). So I still not see performance improvements on my machine. I also tried using |
So, you mean, that master still runs for 14 secs? |
And what about |
@incendial I have a small idea: maybe we can ask Telegram community in dart code metrics channel to help us to check if this PR improves analysis performance? |
Let's measure it on Windows first (@dkrutskikh will do it today) and then we'll maybe go this way, if he'll get different results than you did. I guess, two reports for Windows regression will be enough. |
That's very strange since it's available only in cli mode and even if we assume the server launches the plugin too, it still shouldn't affect it at all... |
Let's wait for results from @dkrutskikh.. I think we should figure out if the problem is Windows-specific or it happens only on my machine. |
@incendial @roman-petrov here are results I've got: test.cmd @echo %time%
@call dart run bin/metrics.dart analyze lib > nul
@echo %time% master
add-bytestore
|
I decided to repeat the test on my machine. That's strange, but I got different results. Maybe, yesterday I had some Windows environment-related problems like running anti-virus or something like that... So today results are:
So finally I see performance improvement too. Thank you for all your work! |
Finally 🎉 |
Maybe, it would be interesting for you: I compared dart_code_metrics 4.1.0 with 4.2.0 on our monorepo and the results are great, please take a look: 4.1.04.2.0So as you see, there is a 3X (115s -> 42s) performance improvement! Thank you for your great work! PS. Screenshots are from my workflow tool that we will use within our company for Flutter / Dart projects. |
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix
[ ] New rule
[ ] Changes an existing rule
[ ] Add autofixing to a rule
[ ] Add a CLI option
[X] Add something to the core
[ ] Other, please explain: