You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Josh Long <st...@gmail.com> on 2006/11/01 19:12:34 UTC

Re: Optimizing dojo and the tapestry js source code

Yikes. what a difference an ant build makes!

I built a compressed dojo build with a cursory look at the firebug xml http
requests and just put that in a custom profile and then overwrote the
tapestry heads version of dojo and built that and boom: my site had no
xmlhttp requests coming from dojo anymore (well, except, peculiarly, from
src/dom/__package__.js and src/html/__package__.js and
src/html/style/__package__.js) and only like 9 coming from the default
tapestry stuff plus 2 from my own stuff.. essentially the resultant pages
are now visible and responsive to a client in under 3s (not 3s to excute, 3s
before the page is actively and perceptively loading... by the same metric,
were faster than cnn.. heh). anyway removing these low hanging fruits (just
the dojo stuff until i can figure out how to bake all the tapestry stuff
into a single file build) literally tripled more than doubled our speed. 20
requests down to 9 requests (even if the resultant js is now 250k) makes for
a) less to download (after all, the resultant dojo.jhs is compressed src) b)
less handshakes and things that might succumb to network latency in
roundtriping so header overhead is minimalized c), more pages of code that
will be also be later cached in browsers.

It's antithetical to common sense.. you figure a rally compressed minimalist
dojo.js initially will improve performance and then the stuff can be
downloaded as needed.. well, it turns out most of its needed on page load
anyway so youve only seperated the work, not reduced it. Plus, the
dojo.require mechanism is synchronous/blocking, so you dont even get the
much vaunted, perceptual advantage of asynchrnocity in ajax...

The trick wil be to now try plugging in a custom dojo build instead of
having to rebuild tapestry itself each time.. the last thing i want to do is
branch and maintain (sync) a tapestry release! Using dojoSource, dojoPath
doesnt seem to work on the normal places.. (well, i havent tried just
sticking the .js in the /src folder of my classes and using
classpath:/js/dojo. i will try it if i must, but it sounds evil. Is there
anyway to get the context:/ options working or am i missing something
hideously obvious?

Anyway, forgive the deluge and thanks in advance for any help,

Josh
ps:I hope your Halloween went well (if it went at all, that is)

On 10/31/06, Josh Long <st...@gmail.com> wrote:
>
> Sounds good so far! Thatll good to know.. what would building/baking the
> tapestry files into dojo.js or some file where its compressed look  like?
>
> That is, i have the tapestry head on disk and im in /js/ and i see
> tapestry, dojo, and a few other directories. i also see a tapestry profile
> .js -- how would i use that setup to get a build with tapestry.namespace,
> and tapestry.* etc... I know what to do to get a dojo build from head to
> produce a custom profile... what's it look like iwth the tapestry js files
> baked in? What do i modify? What's the equivalent of ant -Dprofile=foo
> release compress in the tapestry tree with the tapestry packages baked in?
>
> Thanks,
>
> Josh
>
> On 10/31/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> >
> > Oh..And don't forget the "intern-strings" ant build option. That will
> > embed
> > the templates/css into the main dojo.js file as well.
> >
> > On 10/31/06, Jesse Kuhnert <jkuhnert@gmail.com > wrote:
> > >
> > > The dojo build system can compress its own and your (or tapestry) js
> > > packages all into one file. You'll probably have to dig around in
> > > manual.dojotoolkit.org to find more.
> > >
> > > When you are really getting serious about optimizations though I would
> > > check out the jslinker provided with dojo as well. It will condense
> > your js
> > > into ~exactly~ only the functions/code your app uses. I haven't
> > actually run
> > > it myself but I know Andy has.
> > >
> > >
> > >
> > > On 10/31/06, Josh Long <st...@gmail.com> wrote:
> > > >
> > > > I'm experiencing a ridiculous slow down in speed on a front page
> > because
> > > > the
> > > > initial page uses a few widgets whcih themselves use other dojo
> > > > packages,
> > > > few of which are included in the default dojo.js that comes bundled
> > with
> > > >
> > > > tapestry. So, i built a dojo.js equivalent to te kitchen sink build
> > with
> > > > a
> > > > few extra packages (dojo.dom, dojo.regexp, and more are a few
> > packages i
> > > > added for good measure.. anyway, this has worked out pretty well
> > thus
> > > > far:
> > > > the front page loads all  of the code from dojo/* in one js file
> > (well,
> > > > i do
> > > > see two xmlhttp requests for the templates of a few widgets, of
> > course,
> > > > but
> > > > everything else is readily available.) instead of in 40 seperate,
> > non
> > > > compressed, header-incurring requests.
> > > >
> > > > I have the tapestry source code checked out and have one more thing
> > i
> > > > want
> > > > to do but im not sure what the right mechanism is: how do i get all
> > the
> > > > tapestry packages to be in one fle that i can load manually like i
> > do
> > > > dojo.js? that way id have only two files that i could tune
> > individually
> > > > that
> > > > load the code specific to my app and theyd all be cacheable (ie, not
> > > > paged
> > > > trough xmlhttp, which is a problem fr example in FF pre 1.5 . .) .js
> > > > files and
> > > > theyd all require only one round trip and no headers.. we have
> > pretty
> > > > bad
> > > > latency are really looking to streamline individual requests to the
> > > > server.
> > > >
> > > > Any help would definitely be appreciated...
> > > >
> > > > thanks,
> > > >
> > > > Josh
> > > >
> > > >
> > >
> > >
> > > --
> > > Jesse Kuhnert
> > > Tapestry/Dojo/(and a dash of TestNG), team member/developer
> > >
> > > Open source based consulting work centered around
> > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> >
> >
> >
> >
> > --
> > Jesse Kuhnert
> > Tapestry/Dojo/(and a dash of TestNG), team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> >
> >
>