views:

3280

answers:

2

I've developed a web application using MyFaces 1.2.6 and Richfaces 3.3.1GA (just upgrated). Despite the ease of use, I found out that Richfaces components are very slow.

I also found out that they didn't really take advantage of the browser caching mechanism, they keep sending some lousy JS file every request and other things. I really would like to apply some rules described in the "High PErformance WEbsites" book, but I can't change de generated js and HTML code.

Does anyone have some tips for frontend performance tuning using Richfaces?

Thanks.

+7  A: 

Have a read of this article.

Are you using Firebug + YSlow to check what is being stored in the cache? Using the web.xml org.richfaces.LoadScriptStrategy setting, you can tell Richfaces to either:

  • Load all script in one file.
  • Load no scripts (you do it yourself instead - eg. in the manner prescribed by your book).
  • Load scripts when needed (the default).

But some basic principles :

  • Never put logic into your getters. They are called multiple times and should only return something already populated by another method. For example if you are chaining drop-downs together use an a4j:support tag on the first one with an action attribute that loads the data which is then retrieved when you reRender the second one.

  • Use the ajaxSingle="true" unless you actually want to send the whole form back to the server.

  • Don't use a rich component if you only need a normal one. For example don't use rich:dataTable unless you are making use of some of the features that it has over and above h:dataTable.

Damo
A: 

You can use: org.ajax4jsf.DEFAULT_EXPIRE 31536000

So that all js, css files (generated by richfaces) are cached for 1 year on the browser. This really improved speed in our project.

Also, we do not need to worry about if we change richfaces version as when we change richfaces version it will generate different files.

Vineyard