On 3/4/06, Bill Barker <[EMAIL PROTECTED]> wrote: > > "Costin Manolache" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > On 3/4/06, Remy Maucherat <[EMAIL PROTECTED]> wrote: > >> The only solution is to forbid > >> scriptlets (or as an option use a processing when a page does not > >> contain scriptlets - and of course, rewrite a significant amount of > >> Jasper - way cool :D), in which case compilation is not needed, and we > >> can simply execute the nodes (memory is saved by optionally discarding > >> the nodes between requests). > > > >Why ? It could as well save all static content in a separate file ( I > >remember this was implemented at least in part ), and instead of > >generating the strings in the class, use > >a cache that manages the string table. > > > > The Jasper with 3.3 has this as an option. Since it's main use was to > shrink the size of the _jspservice method, and Jasper2 has a better approach > to this, it was dropped in Jasper2. Also, in 3.3 Jasper, the static text > object is a static object in the class, so you don't get any memory benifits > from using it. > > I'm also with Remy on this that almost all users would rather trade memory > for speed on this issue. However, if you want to make it an optional > behavior for Jasper to store the static text as either a serialized char > [][] as in TC 3.3, or ResourceBundle, by all means, knock yourself out ;-).
3.3 implementation was far from perfect, but I think it was in a good direction. It seems this patch won't pass - but maybe other patches could make at least small improvements in reducing the required memory use, and let users do the trade they want. I agree with you and Remy that memory is cheap and it's good to trade memory for speed - if you can fit all your database, plus all the pages and servlets in memory - you have a perfect situation. But there are a lot of cases where you can't put everything in memory, and you have to choose what to keep in memory - maybe a large buffer for database, and some common pages - but keep infrequently used stuff out, or unload things that are not in use. It's not always as simple as 'just keep everything in ram'. > > >That would be more flexible than this patch - and allow more control > >over how much memory is used. Well - with all the APR and sendfile you > >could even try to send large chunks of static content from disk - not > >sure what's the performance benefits in the static servlet for > >example. > > > > In most non-example JSPs, there really aren't many big blocks of static text > to sendfile. They tend to look more like: > <c:forEach items="${itemList.items}" var="foo"> > <tr><td>${foo.name}</td><td>${foo.price}</td><td>${foo.available }</td></tr> > </c:forEach> > Unfortunately jasper ( and JSPs ) are a bit too complex - maybe a simpler template system could be used to play with such memory management experiments. Well - since JSP has no chance of fitting in my memory requirements ( 32M RAM on my NSLU2 ) - I'll probably have to try something... Costin