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
DRT_InstanceOf uses 49% of total CPU #47680
Comments
@scheglov can you provide us the command line to reproduce this situation. |
You will need https://dart-review.googlesource.com/c/sdk/+/220070 I run it with FYI
|
In this code Manual loop performs |
I tried passing |
I see the following ways of improving performance in this case:
@mraleph @mkustermann @sstrickl WDYT? |
To maybe rephrase @alexmarkov 's suggestions (and add one) for improving general
|
Bug: #47680 Change-Id: I7e90f52e7658eef4b9280f485b457d86ac0f4e9a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229820 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
I expect that https://dart-review.googlesource.com/c/sdk/+/308941 and its recent predecessors have probably improved this situation, since STCs are now larger and also are hash-based at most sizes for quick lookup, though a TTS-like solution to |
Thanks for the update, @sstrickl ! The one issue we have with A concrete example that makes the CFE slow (/cc @jensjoha @johnniwinther ) is a stack implementation that's on the hot path (see here): Object? pop(NullValue? nullValue) {
final Object? value = array[--arrayLength];
...
if (value is! NullValue) {
return value;
}
...
} There's many different kinds of objects being Though for this case (and other similar situations) we could do an exhaustive inline cid-range check for the |
It actually should do an exhaustive cid-range check for the
kMaxNumberOfCidRangesToTest (currently, 4 ).
(The fact that we saw it hit the STC, since we needed 0304832 to reduce the overhead until stubs handled hash-based caches, makes it clear that it doesn't and now I'm curious as to why as I'd only expect 2 cid ranges at most here unless I'm forgetting something... maybe there is an additional range for the bottom types as well, but those should be consecutive and thus a single additional range, making it 3 ranges.) |
I think the code you refer to is for |
... right. Yes. Of course. 🤦♀️ |
Interestingly, I observe this only when I'm running benchmarks, i.e. run Dart from Dart and drive Dart Analysis Server with requests. Maybe too intensive, and VM does not get time to do some background optimization work?
With
var extensions = exportElements.whereType<ExtensionElement>().toList();
With
The text was updated successfully, but these errors were encountered: