myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Werner Punz <werner.p...@gmail.com>
Subject Re: jsf-uncompressed.js in dev mode does not work out entirely
Date Sat, 26 Jun 2010 10:45:38 GMT
Am 26.06.10 11:39, schrieb Jan-Kees van Andel:
> I've been out for a while, so it might be a stupid question. Do you
> serve the script via a servlet or is the file served directly?
>
The files are resources within the api package so they are basically 
served from the standard faces-servlet.


> I ask because last year I did some performance tests for a client and
> having a servlet write a string is very expensive, compared to serving a
> static file. 100ms vs.10ms in my test environment.
>
Yes thats where the cache control kicks in, in runtime mode you have
full caching enabled so that the servlet is not hit too often regarding 
resources, in development mode cache is disabled.


> For this reason, I enhanced my maven build to package all script files
> into one big, compressed one which was put into the webroot and served
> directly, when in production mode. When in dev mode, I served the
> separate, raw files. This (among other things) made the application very
> fast. (I used a yuicompressor maven plugin)
>
Actually I think this is out of the question for the bundled script.
However we too use YUICompressor to precompress and bundle the scripts 
(which makes the filesize initially about 50% smaller) , also only one 
file is served. But I think the biggest gain is if you can enable gzip 
on your server, then you basically get a 90%-95% filesize reduction for 
free. (However IE6 has its fair share of problems with that method afair)
I do not want to gzip the file within itself, this would be another 
additional compression method, because it just slows down the initial 
loading, by having the browser uncompress the file within its engine.
It also is considered to be security risk because you cannot determine 
the contents of the file anymore, easily.


> I didn't use jsf, but a custom framework, but I think this should be
> doable in myfaces too. Or maybe it already does?
>

See above. jsf.js has to be part of the jars and hence has to be served 
from the servlet, but nothing prevents you to unbundle it and serve it 
yourself. But I personally think the speed gains in production mode are 
neglectable due to browser caching.


Werner


Mime
View raw message