[DO_NOT_MERGE] research: CLI performance issue profiling #344
[DO_NOT_MERGE] research: CLI performance issue profiling #344
Conversation
Codecov Report
@@ Coverage Diff @@
## master #344 +/- ##
==========================================
+ Coverage 77.61% 77.76% +0.14%
==========================================
Files 143 143
Lines 3302 3324 +22
==========================================
+ Hits 2563 2585 +22
Misses 739 739
Continue to review full report at Codecov.
|
@roman-petrov please try to migrate on getResolvedUnit2 |
@dkrutskikh, I already tried to migrate to |
@roman-petrov the problem is that this is the only known way to get info about types. We can use I will take a closer look later. |
@incendial, thank you for the clarification. I understand that this not an easy to solve issue. But currently due to this issue CLI speed might be not acceptable in relatively large code base... I see several ways to improve this:
It seems I will also continue investigating ways to solve this issue and will keep this PR open if you don't mind (or we can convert it to issue). |
Also we can investigate #313 and it can solve the problem. Either way it requires a deeper research. |
sure, #313 may partially solve the problem (after the underlying Dart SDK issue is fixed) but we still have it when running in dart code metrics CLI |
Agreed. I'll take a closer look after 4.0 is released. |
@incendial - at the moment do not have time and ideas that would quickly fix this performance problem. Maybe it will be better to close this PR for now? |
@roman-petrov I think we can try some ideas, but I don't think that it's a quick fix situation. Let's have the PR open for now, we should probably increase the priority of this problem. |
ok, let's leave it here for now. I also may put some effort into this in the future since linting speed is important for large / relatively large codebases. Although I have a quick idea. You have a GitHub acition but it is not integrated into the dart code metrics repository itself. Maybe, it would be better to add this action first to "see" CLI performance. |
@roman-petrov is it a blocker for you to start using the package? Think that might affect how we prioritize this. |
@incendial, yes, the performance issue is almost blocking us from starting. But at the moment it is not critical for us: we have a huge amount of other things to do while migrating our UI development technology stack to Flutter. |
@roman-petrov then I need to know what is a "good enough" performance for you and are you ready to not being able to use some analysis lints if it will be the only way to fix the problem? |
I mean, some rules just won't work without full dependencies resolution (especially, flutter rules). |
Actually, I don't have an exact answer to this question. I would say something like: the performance will be good enough if the time For example, if |
Actually, as I understand, the performance issue we discuss is somehow related to Just another "draft" idea: |
Got it, sounds pretty reasonable.
Yeah, thats one way to look at it, but we definitely need a more deep research. |
I think we finally find out what was the problem, closing due to: #428. |
I started integrating the project into our codebase and found that CLI runs extremely slow compared to
dart analyze
command.dart analyze
command takes about 3-5 seconds on our codebase,dart_code_metrics
CLI runs about two minutes.I am not sure if this is some environment configuration or maybe Windows issue. On my machine results of this simple profiling code are:
contextForMs: 76, getResolvedUnitMs: 115290, runAnalysisforFileMs: 128
.So
analysisContext.currentSession.getResolvedUnit
method call seems to be extremely slow (in another performance test I made I see that it might even take several seconds to complete for just one file). At the moment I do not know how to speed up this...@incendial, @dkrutskikh - can you please check (when you have time) if this issue can be reproduced on your machines and if we actually have serious performance issue here?