-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Make 'as' cheaper in AOT #34582
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
That is indeed confusing considering the VM has to do checks either way. |
Yes, we are going to look at this soon. @mkustermann has a CL which we will land when he is back from vacation. This is legacy stuff (implicit and explicit |
Now that I'm back from vacation I'll start working on this. In #34097 we got the green light from the language team to treat implicit and explicit casts the same way. |
This makes explicit downcasts more efficient by re-using the optimizations we already have for implicit downcasts. For implicit/explicit as checks we use the symbol to distinguish which exception to throw if the check fails. So this does not actually require unification of _CastError and _TypeError. Issue #34582 Issue #30632 Issue #30571 Change-Id: I7b8818d2698e249c90a3e1b8790bad69ada649a9 Reviewed-on: https://dart-review.googlesource.com/c/78748 Commit-Queue: Martin Kustermann <[email protected]> Reviewed-by: Alexander Markov <[email protected]> Reviewed-by: Vyacheslav Egorov <[email protected]>
Closing this, as implicit/explicit |
In flutter/flutter#21813, @mraleph wrote:
Is there any chance we could make
as
generate the same cheap code as an implicit cast in an assignment? My understanding is that with Dart2 there's now no reason why they should be different.Flutter would like to disable all implicit casts and replace them all with
as
. We currently can't do that because we have theavoid_as
lint enabled specifically because of this performance concern.The text was updated successfully, but these errors were encountered: