From fe6c9e3f1693f2e6db5ae69517893894bbac6afb Mon Sep 17 00:00:00 2001 From: Aleksandar Prokopec Date: Wed, 15 Feb 2012 15:37:42 +0100 Subject: Add parallel size computation for ParCtrie. Also modified size computation for Ctrie so that concurrent `size` invocations can be parallelized more efficiently. --- test/files/run/ctries/concmap.scala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test') diff --git a/test/files/run/ctries/concmap.scala b/test/files/run/ctries/concmap.scala index 85a305ce5b..d73e33182a 100644 --- a/test/files/run/ctries/concmap.scala +++ b/test/files/run/ctries/concmap.scala @@ -164,6 +164,25 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), None) } + "compute size correctly" in { + val ct = new Ctrie[Wrap, Int] + val sz = 36450 + for (i <- 0 until sz) ct(new Wrap(i)) = i + + assertEqual(ct.size, sz) + assertEqual(ct.size, sz) + } + + "compute size correctly in parallel" in { + val ct = new Ctrie[Wrap, Int] + val sz = 36450 + for (i <- 0 until sz) ct(new Wrap(i)) = i + val pct = ct.par + + assertEqual(pct.size, sz) + assertEqual(pct.size, sz) + } + } } -- cgit v1.2.3