Is the cost of the cast a real or a perceived performance issue? Both can definitely be bad, but I am curious if you have been able to make something faster by not using 'as' casts. An interesting experiment would be to hack the Dart VM to ignore 'as' casts and see if the performance of some app or benchmark improves.
Cheers,
Kasper
--
You received this message because you are subscribed to the Google Groups "Dart Core Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to core-dev+u...@dartlang.org.
Is the cost of the cast a real or a perceived performance issue?
Both can definitely be bad, but I am curious if you have been able to make something faster by not using 'as' casts.
An interesting experiment would be to hack the Dart VM to ignore 'as' casts and see if the performance of some app or benchmark improves.
Hi,In looking at Flutter code, and later, code in dartdoc, I see cases where we are either really tempted to, or in fact did, use `as` to say "this variable should be of type Foo, so analyzer, don't worry, the method call will work". However, it feels weird to pay the runtime cost of `as` in almost all cases. My question for the group is: Has there been any discussion around a check-mode-only cast?
I find the version with local variables more readable than the ones with nested expressions since it can be read one line at a time, rather than inside-out.
I might use shorter local variable names (dec, src), to reduce repetition. When the only reference is on the next line, they can be really short.
T cast<T>(dynamic x) => x;... cast<Declaration>(node)....