Heads up guys, I just profiled my app trying to squeeze every last drop of performance out for speedups on the iPhone which has slow Javascript, and I noticed that the canCastUnsafe/dynamicCast functions are collectively eating up 8.5% of the total runtime. It seems that the sole purpose of dynamicCast() is to throw a ClassCastException where the JVM would, but in production web-deployment mode, I would honestly prefer the option of having these checks omitted. Yes, there are some cases where throwing the exception would give the end user a better error message, but if the user is able to reproduce incorrect behavior, I think I would prefer to direct them to a debug build/permutation which has the checks. It seems the major place where this could trip up legitimate code is if someone was triggering CCEs on purpose and expecting to catch them with an exception handler.
The main reason these checks are being inserted is because I switched from using a custom collection, to a List<Foo>, and the compiler appears to be unable to use the generic type information of the JField to determine that the cast is unneccessary. Anyway, the question for discussion is, should the compiler have an -O2 mode which eliminates range checks, runtime cast checks, etc -Ray --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
