@Benchmark public void parallel_eager_forkjoin_gsc() { MutableMultimap<Alphagram, String> groupBy = FJIterate.groupBy(this.gscWords, Alphagram::new); groupBy .multiValuesView() .select(iterable -> iterable.size() >= SIZE_THRESHOLD) .toSortedList(Comparators.<RichIterable<String>>byIntFunction(RichIterable::size)) .asReversed() .collect(iterable -> iterable.size() + ": " + iterable) .forEach(Procedures.cast(e -> Assert.assertFalse(e.isEmpty()))); }
@Benchmark public void parallel_lazy_gsc() { ParallelUnsortedBag<String> parallelUnsortedBag = this.gscWords.asParallel(this.executorService, BATCH_SIZE); UnsortedBagMultimap<Alphagram, String> groupBy = parallelUnsortedBag.groupBy(Alphagram::new); groupBy .multiValuesView() .select(iterable -> iterable.size() >= SIZE_THRESHOLD) .toSortedList(Comparators.<RichIterable<String>>byIntFunction(RichIterable::size)) .asReversed() .collect(iterable -> iterable.size() + ": " + iterable) .forEach(Procedures.cast(e -> Assert.assertFalse(e.isEmpty()))); }
@Warmup(iterations = 20) @Measurement(iterations = 10) @Benchmark public void serial_eager_gsc() { MutableListMultimap<Alphagram, String> groupBy = this.gscWords.groupBy(Alphagram::new, FastListMultimap.newMultimap()); groupBy .multiValuesView() .select(iterable -> iterable.size() >= SIZE_THRESHOLD) .toSortedList(Comparators.<RichIterable<String>>byIntFunction(RichIterable::size)) .asReversed() .collect(iterable -> iterable.size() + ": " + iterable) .forEach(Procedures.cast(e -> Assert.assertFalse(e.isEmpty()))); }