Hi,

thanks for implementing it.  There are some thoughts (about EL
generally):

1) Many big views (where creation of expressions costs nonnegligible
time) use ui:param (or other tag for variable mapping) thus optimization
there is not possible. It depends on style of programming but I checked
about 30 "most important" views in our company and variablemapper always
contains a mapping so no cache is used there.

2) Cache of precompiled expression is resposibility of EL-impl
(container). JUEL does it and it is good performance improvement; about
other implementations I'm not sure.


3) summary of problem: for one attribute in xhtml, 
myfaces create :
* one instance of valueExpression with
EpressionFactory.createValueExpression
* one instance of TagValueExpression/TagValueExpressionUEL (wrapper)
* optionally one instance of LocationValueExpression (wrapper for
composite component)

* lifespan of those instances is request, so they immediatelly GCed. 
* performance of createValueExpression is unknown and depends on
implementaion of EL. 


4) summary of requirements:
* reduce number of objects created for one attribute expression (ideally
to zero)
* minimize dependency on methods with unknown performance (like
createValueExpression)
* preserve functionality of VariableMapping

The main problem for implementation of such requirements is that EL
spec. does not allow fine grained operations. 

For example we cannot provide own implementation is some factory method;

We can fill issue against EL spec and wait for years for fix (like null
-> 0 coercion problem waits for it's solution). 

Or we can cooperate with one EL-implementation to prototype some
improvements (like how to avoid decorator pattern for expressions).

Regards,

Kočičák

Leonardo Uribe píše v Po 30. 05. 2011 v 16:00 -0500:
> Hi
> 
> There is a patch proposed (after many months thinking about it),
> according to the discussion on:
> 
> http://markmail.org/message/kca64ojdvb6em367?q=%5Bcore%5D+performance:+TagAttributeImpl+part+II:+object+allocations
> 
> here:
> 
> https://issues.apache.org/jira/browse/MYFACES-3160
> 
> The idea is cache ValueExpressions when necessary to reduce
> unnecessary object allocations and increase speed, because EL parsing
> is also avoided when necessary.
> 
> I think it is a nice optimization. The idea is detect when the
> VariableMapper has a value and if so, do not cache any expression.
> Additionally, use a volatile variable to store expressions.
> 
> The patch adds a new web config param called
> org.apache.myfaces.CACHE_EL_EXPRESSIONS to enable/disable this
> feature.
> 
> @Martin Koci: since you was the one proposing this optimization, it
> could be good if you can check if it is worth or not (I'm 99% sure, so
> any help to reach 100% is welcome!) . If that so, I'll commit the
> proposed code.
> 
> regards,
> 
> Leonardo Uribe
> 


Reply via email to