[infinispan-dev] About size()

Mircea Markus mmarkus at redhat.com
Fri Oct 10 13:51:24 EDT 2014


On Oct 10, 2014, at 15:25, Dan Berindei <dan.berindei at gmail.com> wrote:

> On Fri, Oct 10, 2014 at 5:20 PM, Mircea Markus <mmarkus at redhat.com> wrote:
> 
> On Oct 10, 2014, at 15:18, Radim Vansa <rvansa at redhat.com> wrote:
> 
> > That we should expose that as one method, not forcing people to
> > implement the sum() themselves.
> 
> Hmm, isn't the method you mention cache.size() ? :-)
> 
> Nope, because we decided to make cache.size() precise-but-slow :)

It's not possible to make it precise unless we provide snapshot isolation /MVCC support.
IMO the formula Tristan provides is a good enough approximation of the size of the data. And definitely way better than what we currently have.
(Looking at CHM.size() they offer an "accurate" size of the map by counting it in a loop and making sure that the size is reproducible. I don't think that's accurate in the general case, though, as you might count intermediate sizes in that loop).

Cheers,
-- 
Mircea Markus
Infinispan lead (www.infinispan.org)







More information about the infinispan-dev mailing list