[infinispan-dev] Collections, immutables and copies

Sanne Grinovero sanne at infinispan.org
Wed Jan 18 13:19:16 EST 2012


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.

Sanne


More information about the infinispan-dev mailing list