[ovirt-devel] Using more specific types in code visible to GWT frontend
Vojtech Szocs
vszocs at redhat.com
Fri Jun 2 15:22:19 UTC 2017
Hello,
in GWT world, being more specific (e.g. using ArrayList instead of just
List) is preferred since the GWT compiler doesn't need to introspect all
possible subtypes and include them in the generated JavaScript. Using too
"generic" types is one of the main reasons of significant GWT-generated
JavaScript size.
I'd like to improve this and I'm wondering what others think.
For example, in BusinessEntity interface, is there any reason why <T
extends Serializable> and not e.g. <T extends Guid> ? If the GWT compiler
sees a reference to Serializable type and it isn't obvious what's the
instance type behind it, it includes *all* Serializable subtypes into the
generated JavaScript. You can probably imagine how many of those are
visible to GWT compiler via Java classpath.
Another example is query & action result allowing arbitrary List/Map/Set
impl. to be passed through GWT RPC. What about limiting us to ArrayList,
HashSet and HashMap for GWT RPC transfer? Please be aware that usual Java
performance tips do not apply to GWT world due to Java-to-JS compilation.
(And therefore, using LinkedList instead of ArrayList has no practical
effect aside from bigger JS footprint.)
I'd like both frontend and backend maintainers to share their thoughts.
Alexander's UI redesign efforts [1] are well on their way into the master
branch and it's a good opportunity to improve existing GWT frontend, making
it smaller & faster for our users.
[1] https://gerrit.ovirt.org/#/c/75669/
Thanks!
Vojtech
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20170602/731eb8ed/attachment.html>
More information about the Devel
mailing list