Re: Performance improvement for FacesCompositeELResolver

From: Martin Aubele <>
Date: Sun, 31 Jan 2010 17:43:21 +0100

now complete

we are working with Icefaces/Facelets/JSF in a very big project with
feature rich UI.
We recognized that we have almost 1.000.000 calls if
FacesContext.getCurrentInstance() during processing of one page.

We could see that JSF is not tuned very well here. Remember
FacesContext.getCurrentInstance() is a loopup to a thread local map.
Please avoid it if possible.

In the attachement you see a patch for FacesCompositeELResolver that
reduces these lookups form 3 to 1 during getValue().

The patch is based on jsf 1.2 but should be done with small
modifications also in jsf 2

In general in FacesCompositeELResolver we find these lines repeated
for several times:

      if (FacesContext.getCurrentInstance() == null) {
             return null;

One call to find out if the context exists, in setChainType and
clearChainType we read it again. So 3 calls instead of one.
Code is tested very well.
Thanks for your help.

BR, Martin