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
Very poor JIT performance with const Map<Type, ..> #55666
Comments
A few more observations:
# JIT
dart type_map.dart 247.04s user 0.58s system 99% cpu 4:09.16 total
# AOT
./type_map.exe 0.05s user 0.01s system 23% cpu 0.244 total
dart type_map.dart 5.70s user 0.48s system 135% cpu 4.561 total |
IIRC, the VM's constant maps are no longer linear lookup (yep, found it). Probably not the issue, but could be the cause. If I generate the If I take the same file and reduce the number of map entries (by commenting out all but the first ten entries, classes are kept in), then the compile time drops.
Does seem to grow very non-linearly. |
The issue with Using appropriate hash to type arguments fixes this - but it is not entirely clear to me why |
FWIW, I am unable to reproduce the problem by using just |
@mraleph, you're correct. The non-linear behavior was only seen with I should've been more clear. With
dart type_map.dart 0.83s user 0.12s system 122% cpu 0.780 total
dart type_map.dart 4.84s user 0.58s system 152% cpu 3.543 total Thanks for looking into it! |
The |
@dnys1 I don't really see drastic performance difference between In your experiment did you actually emit any |
Consider the following program:
My expectation would be for this to run very quickly. And with a small number of types it does. But this balloons in runtime as the number of types increases.
However, this only appears to happen in JIT mode (using 100,000 types).
It gets worse, though. If we introduce a wrapper class, like https://pub.dev/packages/typer for example, it is close to impossible to run with any meaningful size of the map.
Calling
dart run
with this program results in 😱And having this map in a project also completely stalls the analyzer.
Again, though, only for JIT it seems.
Here's a small script to reproduce the problem:
dart info
The text was updated successfully, but these errors were encountered: