Benchmarking Ajax JSF Libraries

Mert Caliskan posted a simple ajax performance test comparing PrimeFaces, RichFaces and Trinidad.  He used simple partial page rendering examples in demo applications which reveals PrimeFaces is 2x/3x faster than RichFaces and Trinidad. Also Alex Smirnov tested the same demo apps and got a set of different results.

Well benchmark tests usually cause debates, I’ve also done similar tests but to improve the accuracy and cause less debates I’ve created three different applications rather than using showcases. All applications are deployed on tomcat6, use server side state management and facelets for view. The box used for testing is a mac book pro 2.4 ghz with 4gb ram running snow leopard.

Let’s start with PrimeFaces.

PrimeFaces

Page: primeppr.xhtml

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.prime.com.tr/ui">
<head>
	<p:resources />
</head>
<body>
	<h:form prependId="false">
		<h:inputText value="#{testBean.text}" />
		<p:commandButton value="Submit" update="out" />
		<h:outputText id="out" value="#{testBean.text}" />
	</h:form>
</body>
</html>

Configuration: None (PrimeFaces is a lightweight library so basically there’s nothing to configure🙂
primeppr

RichFaces

Page: primeppr.xhtml

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j">
<head>
</head>
<body>
	<h:form>
		<h:inputText value="#{testBean.text}" />
		<a4j:commandButton value="Submit" reRender="out" />
		<h:outputText id="out" value="#{testBean.text}" />
	</h:form>
</body>
</html>

Configuration: As far as I know disabling forceparser improves RichFaces performance, so I set forceparser to false.

richppr

Trinidad

Page: trinidadppr.xhtml

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:tr="http://myfaces.apache.org/trinidad">
<head>
</head>
<body>
	<tr:document>
		<h:form>
			<tr:inputText value="#{testBean.text}" />
			<tr:commandButton id="btn" text="Submit" partialSubmit="true"/>
			<tr:outputText id="out" value="#{testBean.text}" partialTriggers="btn"/>
		</h:form>
	</tr:document>
</body>
</html>

trinidadpprConfiguration: I’ve disabled debug setting of Trinidad in trinidad-config.xml.

Results

For 10 requests for the exact simple use case, average processing times are;

PrimeFaces: 8.4 ms

RichFaces: 16.7 ms

Trinidad: 9.7 ms (Note that Trinidad has more optimization features like view state caching which can improve the performance even further.)

I believe these results can be realized as more accurate compared to other two tests I’ve mentioned because for my tests rather than using the different showcase apps I’ve created the same application three times with each library.

I’m glad that PrimeFaces is performing well, the reason is as a result of aiming to keep things simple. PrimeFaces has no servlet filter, html parser, custom viewhandler, custom statemananger and etc. This helps PrimeFaces to keep things clean, do less computation, use less memory and be lightweight. Even acouple of PrimeFaces users were kind enough to provide testimonials which proves it.🙂

9 Responses to Benchmarking Ajax JSF Libraries

  1. matthiaswessendorf says:

    Did you also change the content compression setting for Trindad ?

  2. Isn’t it enabled by default?

  3. jamesgdriscoll says:

    Of course, all this is less meaningful now that that simple case is handled natively by JSF 2.0, which just went FCS today. (Hint, hint.)

    My quick test on JSF 2.0 shows about 12ms response time.

  4. Rubinas says:

    Where is icefaces?

  5. indianaRocker says:

    Great..what about huge dataset rendering ? keep up the good work..

  6. Mediii says:

    Hi, is the STATE_SAVING_METHOD setting to server or client ?
    and what about com.sun.faces.compressViewState
    are you using default values in web.xml ?

    nice job cagataycivici.

  7. Hi, all 3 apps use server state saving and the compressViewState is same as well (not defined using default setting).

  8. Pablo S. Borges says:

    this missing openfaces …..

  9. surfzera says:

    PrimeFaces very good !!

%d bloggers like this: