-
Notifications
You must be signed in to change notification settings - Fork 1.7k
eliminate implicit casts/dynamic dispatch in DDC's SDK impl #30481
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
Comments
Yeah, this could definitely be useful. It's not far off of what @matanlurey was looking for with a flag to turn off dynamic operations as well - I'd bet if we could surface this in a nice way, then performance sensitive users might be interested in opting in to this. It would be great to be able to audit the core SDK libraries in some way as well. I found some dynamic calls in json parsing by profiling, but I'm sure there's more lurking in there. |
I've done a few passes of cleanups, but this would still be good to look into. |
I had some progress in this CL, if someone wants to revive it https://dart-review.googlesource.com/c/sdk/+/77016 |
@sigmundch - I'd imagine a bunch of implicit casts got cleaned up with the null safety migration. Do you know if there is still more worth doing here? |
Since implicit downcasts from dynamic are still allowed, I expect we may still have some left. It might be worth adding some unit test to detect them, that way we prevent accidentally adding more. Dart2js already has a similar test, so we may be able to adapt it (the test basically ensures all dynamic accesses are previously mentioned in these whitelist file https://github.com/dart-lang/sdk/blob/master/pkg/compiler/test/analyses/api_allowed_nnbd.json) |
|
Implicit casts and dynamic operations sometimes sneak into the generated code, causing a loss of performance. We could disable these to prevent them from being used in our private patch files/SDK implementation libraries. I'm unsure if the shared SDK code uses either of these, but we could specialize (via
external
) so DDC can implement those in a typed way.EDIT: and to be clear, I'm mainly concerned with DDC's own SDK impl code. Because we're using a fair amount of
JS
builtins, it's easy to accidentally end up with implicit casts ordynamic
where you didn't intend to do that.The text was updated successfully, but these errors were encountered: