I was typing up an email and then Joel's response arrived covering much of what I was typing, so I'll just add to his points: The first thing I was going to mention is that, as I understand it, pyjamas loads modules by injecting a script tag and then running a timer to determine when the module has loaded. I'm curious why it doesn't just add a callback to the module script to avoid the timer?
The second thing is a more general question. GWT's code splitting is largely about doing analysis to determine code dependencies between the various split points. It sounds like pyjamas simplifies split points by just making them modules, but does it do any dead code elimination or does it just translate the entire module to javascript? /kel On Wed, Mar 11, 2009 at 4:42 PM, Joel Webber 𐑯(ټ)𐑥 <[email protected]> wrote: > Code splitting, as in > http://code.google.com/p/google-web-toolkit/wiki/CodeSplitting > The particular design we're pursuing (and by "we", I mean "Lex") is one > that will take asynchronous split-points you define in your application code > and have the compiler statically determine the optimal set of generated code > to put in each fragment. It takes advantage of the fact that Java (without > reflection) is fully statically analyzable to do so. > > I'm glad to hear that Pyjamas is attempting to attack the code-bloat > problem in a somewhat analogous way, and the two implementations may have > something to learn from one-another in how they actually fetch the remote > code. As for the actual splitting algorithm, Python is an entirely different > beast, whose dynamic nature will require possibly-incorrect user guidance as > to the dependency graph, and I'm pretty certain it can only asymptotically > approach "optimal" dependencies, with the possibility of error becoming > greater the more one tries to find the optimal set of dependencies by hand. > > I believe Lex started by trying to use <script> tags, but they have the > significant disadvantage that you can't tell when one fails to load, > reliably, on all browsers. You can fetch the scripts using XHRs, but there > are some significant hurdles to using eval() on the resulting script text, > as described by Lex, here: > http://lexspoon.blogspot.com/2009/03/many-scopes-of-javascripts-eval.html > > Hope this clears things up a bit, > joel. > > On Wed, Mar 11, 2009 at 4:31 PM, lkcl <[email protected]>wrote: > >> On Mar 11, 5:58 pm, Ray Cromwell <[email protected]> wrote: >> > If by this, you mean code splitting, you might want to look at the GWT >> trunk. >> >> code splitting - as in 'splitting classes into separate javascript >> cache files and using s = document.createElement("script"); s.src = >> "class.name.ui.something.cache.js"; document.appendChild(head, s); ' >> and then going into a timer loop, waiting for it to load ? >> >> if that's been done already, _great_. saves _vast_ amounts of >> duplication of compiled javascript. >> >> pyjamas GAE users are hitting the limit with just a simple >> application, thanks to 500k of pyjamas ui libraries - duplicated 5 >> times between the 5 platforms. >> >> so GWT developers will benefit enormously from the same functionality. >> >> l. >> >> >> > > > > -- If you received this communication by mistake, you are entitled to one free ice cream cone on me. Simply print out this email including all relevant SMTP headers and present them at my desk to claim your creamy treat. We'll have a laugh at my emailing incompetence, and play a game of ping pong. (offer may not be valid in all States). --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
