[infinispan-dev] Collections, immutables and copies

Manik Surtani manik at jboss.org
Thu Jan 19 05:59:07 EST 2012


Agreed.  But lets do this scientifically.  Sanne, have you got a list of the Collections used and where, in order of their impact on overall performance?

On 19 Jan 2012, at 12:47, Bela Ban wrote:

> This makes a lot of sense IMO, as I've done similar things in JGroups 
> (e.g. my own optimized hashmap "Headers" in Message).
> 
> On 1/18/12 7:19 PM, Sanne Grinovero wrote:
>> Hi All,
>> after some profiling I've seen that even to manage a single command,
>> there is a huge amount of List<Address>, Map<Address,[something]>,
>> HashSet constructions involved; often they are defensively copied as
>> many methods might potentially remove a couple of elements, but this
>> event is very unlikely.
>> 
>> So I think the standard collections are unfit for this purpose, as
>> this is pretty much a constant, and also HashSets are not fit for the
>> purpose as most commonly they will contain a very small amount of
>> addresses.
>> 
>> I started as a draft to change this to a custom collection which would
>> be immutable by default and provide efficient implementations for the
>> specific use cases Infinispan has, and while proceeding in making more
>> and more changes to make it compile I convinced myself that it was the
>> way to go as the amount of copies and operations performed on these is
>> impressive, and this was going to avoid most of the work.
>> 
>> BUT I'm changing way more code than expected, including lots of
>> interfaces, and keeping deprecated copies makes it too complex.
>> 
>> So even if this was meant to be a draft and I didn't even finish it,
>> I'm aborting the task already and proposing to do something similar
>> for 6.0.
>> I can say now that it's a big work, and while I don't have performance
>> tests backing this I expect it to be worth it.
> 
> 
> -- 
> Bela Ban
> Lead JGroups (http://www.jgroups.org)
> JBoss / Red Hat
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Manik Surtani
manik at jboss.org
twitter.com/maniksurtani

Lead, Infinispan
http://www.infinispan.org






More information about the infinispan-dev mailing list