struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jed Wesley-Smith (JIRA)" <>
Subject [jira] Commented: (WW-3457) Significant performance improvement for freemarker TagModel
Date Thu, 10 Jun 2010 05:53:13 GMT


Jed Wesley-Smith commented on WW-3457:

> Did you profile that ... ?

Yes, we saw this as one of the major causes of blocking in multi-threaded and a significant
hotspot in the single-threaded profiled runs.

> Solved, thanks!


> Significant performance improvement for freemarker TagModel
> -----------------------------------------------------------
>                 Key: WW-3457
>                 URL:
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: Jed Wesley-Smith
>            Assignee: Lukasz Lenart
>             Fix For: 2.2.0
> The class org.apache.struts2.views.freemarker.tags.TagModel creates a new freemarker.template.DefaultObjectWrapper
for each call to unwrapParameters(Map). The problem is that that class is quite expensive
to construct as the super-class does a quite bit of introspection to fill up its caches. Not
only is this a lot of work, it tends to hit the Introspector class pretty hard, which internally
does a lot of sychronising. In our soak performance tests this was a significant cause of
blocking in our application.
> The DefaultObjectWrapper (or more properly the freemarker.ext.beans.BeansWrapper class
as that is actually all the TagModel is using) is actually meant to be a cache that prevents
exactly this kind of slowness, so constructing a new one every time is counter-productive.
> I don't have the latest source handy so I can't provide a patch, but the change is to
simply replace the line:
>     	DefaultObjectWrapper objectWrapper = new DefaultObjectWrapper();
> with:
>         BeansWrapper objectWrapper = BeansWrapper.getDefaultInstance();
> in the second line of TagModel.unwrapParameters(Map params)

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message