Hi All,

I've been investigating some performance issues on a project that's using
Camel. As part of this I've noticed that bean expressions execute far more
slowly than expected. For example the following line takes over 1ms in our
tests whereas using a processor to do the same thing takes something like
0.001ms;

setHeader("key", bean("java.util.UUID", "randomUUID"))

We measured this by setting a header before the line with the value of
System.nanoTime() and retrieving this value in the after the line had
executed. We also ran several 1000's of messages and got the same results
every time. This doesn't seem to be a problem with bean definitions.

I've dug into the code and think I've found the problem. When a
BeanProcessor is created a BeanHolder is also created and kept as a member
variable. The BeanHolder contains a BeanInfo object that actually performs
the introspection of the target bean. This means for a BeanProcessor the
target bean is only introspected once. However for a BeanExpression the
BeanHolder is created in the evaluate method and therefore a new BeanInfo
object is created for every message and the target bean gets introspected
for every message. 

My question is; is there a reason for this or could the BeanExpression
implementation change to cache the BeanHolder object?

Thanks,
Mark Hillary

--
View this message in context: 
http://camel.465427.n5.nabble.com/Bean-Expression-Performance-tp5715003.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to