[jbosscache-dev] Notifier - performance optimization

Manik Surtani manik at jboss.org
Wed May 21 10:48:25 EDT 2008


On 21 May 2008, at 12:38, Mircea Markus wrote:

>
>
> Manik Surtani wrote:
>> My comments below:
>>
>> On 20 May 2008, at 22:57, Mircea Markus wrote:
>>
>>> 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.
>>
>> Are you looking at trunk?  I can see that the defensive copy is  
>> only made *after* checking for whether a listener exists.
>>
>> E.g., in notifyNodeModified():
>>
>>          if (listeners != null && !listeners.isEmpty())
>>          {
>>             boolean originLocal = ctx.isOriginLocal();
>>             Map dataCopy = copy(data, useMarshalledValueMaps);
>>        ... etc ...
>>    }
>>
> I am referring to the maps which are being passed to the notifier,  
> not the one that are being build within the notifier itself.
> E.g.PutDataMapCommand
>     Map existingData = nodeSPI.getDataDirect();
>     if (!existingData.isEmpty())
>     {
>        oldData = new HashMap(existingData); // defensive copy
>     }

Wow yes, that is completely pointless.

--
Manik Surtani
Lead, JBoss Cache
manik at jboss.org









More information about the jbosscache-dev mailing list