开发者

Performance of UI:repeat in JSF2/Mojara

In analysing the performance of a JSF2 (Mojara) page returning 200 tabular 开发者_JAVA百科rows I'm seeing 50% of the time taken to respond being in just rendering. For the 4 seconds on a dev box, 2 are purely down to the rendering of this page.

What is the best path to improve performance?

(I've been told to replace ui:repeat with jstl code?)

Due to the complexity of the JSF object tree - the profiler isn't telling me much.


Rendering is the most expensive task at any way. But 2 seconds is pretty a lot (those 2 seconds before rendering also by the way, sounds like poor DB performance). Aren't you heavily using conditionals inside the UIData component? E.g. h:inputText disabled="#{bean.disabled}" and so on.

It's hard to tell the best path to improve performance and it's hard to improve this in the JSF side. Aren't you unawarely including network and/or webbrowser speed in the complete picture? Poor network bandwidth and a small server side response buffer might block the one and other. Poor table rendering performance in the webbrowser might block one and other. MSIE is known to be a disaster in table rendering performance. Try FireFox or Chrome instead.

At any way, replacing ui:repeat with c:forEach isn't going to help much. Even more, the c:forEach is a tad less efficient since it invokes the items on every iteration instead of caching it.


I know this is an old query but here is a solution i have found effective in the past. It all depends on what you are rendering.

For rendering simple string lists its must faster to create a tag lib function

public static String collectionToString(Collection collection, String separator)
{
  if (CisNullOrEmpty(collection))
  {
    return "";
  }
    // custom join implementation
return Utils.join(collection, separator);
}

For more complex ones you could custom functions dependent on objects

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜