[jbosscache-dev] Notifier - performance optimization

Mircea Markus mmarkus at redhat.com
Tue May 20 17:57:57 EDT 2008


Hi,

There is place for some performance optimization with respect to the 
notification mechanism, in the Notifier class:
1) there are defensive Maps being created for being passed in the 
pre/post notifications, even if no listeners are registered.
2) even if we do not have listeners for a certain event, there is still 
a lookup in the listeners map to check for the available list of listeners

Optimizations:
for 1) - do not trigger a notification if no listener registered, use a 
guard - similar to log.isTraceEnabled()
for 2) - rather than keeping a map with listeners registered for each 
annotation type, rather keep the listeners list as a member - this way 
we'll skip the list lookup.

Another thing that just come into my mind is not iterating on the list 
of listeners but rather use sequential access - small gain though.

I expect this would gain us some performance, especially in the 
standalone mode.
WDYT?

Cheers,
Mircea



More information about the jbosscache-dev mailing list