On Fri, Jun 5, 2009 at 8:38 AM, Ray Cromwell <[email protected]> wrote:
> With Iterator, you've got double polymorphic dispatch, first to
> List.iterator(), and then in the returned iterator implementation, a
> call to AbstractList.get(). Whereas, with List.get() you've got a
> single polymorphic dispatch, and a better chance that Hotspot might
> figure out the concrete type and inline it to foo[index].

The second one is unfortunate, because it could be avoided by
implementing the List hierarchy differently.  Maybe GWT could do
better if we had a final SimpleArrayList class of our own that didn't
even subclass ArrayList.  Its iterator method could be defined as
returning a SimpleArrayList.Iterator rather than an abstract
Iterator<T>.  That should help the JVM devirtualize method calls
without needing to change the looping code in GWT.

Reading further in the thread, though, maybe we should simply use -server!

Lex

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to