Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import java.util.concurrent.TimeUnit;
import javax.util.streamex.*;
import java.util.stream.*;
import java.util.function.*;
import java.util.*;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.annotations.*;
@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Fork(2)
@State(Scope.Benchmark)
public class DistinctTest {
@Param({ "100", "10000", "1000000" })
private int n;
@Param({ "2", "4" })
private int k;
@Param({ "distinct", "few", "many", "sorted", "withnulls" })
private String profile;
private List<Integer> input;
@Setup
public void setUp() {
switch(profile) {
case "distinct":
input = IntStreamEx.of(new Random(1), n*2).boxed().distinct().limit(n).toList();
break;
case "few":
input = IntStreamEx.of(new Random(1), n, 0, n*3).boxed().toList();
break;
case "many":
input = IntStreamEx.of(new Random(1), n, 0, n/50).boxed().toList();
break;
case "sorted":
input = IntStreamEx.of(new Random(1), n, 0, n/3).boxed().sorted().toList();
break;
case "withnulls":
input = IntStreamEx.of(new Random(1), n, 0, n/3).boxed().map(i -> i < n/10 ? null : i).toList();
break;
}
}
@Benchmark
public void distinct(Blackhole bh) {
bh.consume(StreamEx.of(input).distinct(k).toSet());
}
@Benchmark
public void distinct2(Blackhole bh) {
bh.consume(StreamEx.of(input).distinct2(k).toSet());
}
@Benchmark
public void distinctParallel(Blackhole bh) {
bh.consume(StreamEx.of(input).parallel().distinct(k).toSet());
}
@Benchmark
public void distinct2Parallel(Blackhole bh) {
bh.consume(StreamEx.of(input).parallel().distinct2(k).toSet());
}
@Benchmark
public void removeIf(Blackhole bh) {
bh.consume(input.stream().collect(
Collectors.collectingAndThen(Collectors.groupingBy(Function.identity(), Collectors.counting()), m -> {
m.values().removeIf(l -> l < k);
return m.keySet();
})));
}
@Benchmark
public void removeIfParallel(Blackhole bh) {
bh.consume(input.stream().parallel().collect(
Collectors.collectingAndThen(Collectors.groupingBy(Function.identity(), Collectors.counting()), m -> {
m.values().removeIf(l -> l < k);
return m.keySet();
})));
}
@Benchmark
public void doubleStream(Blackhole bh) {
bh.consume(input.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
.entrySet().stream().filter(e -> e.getValue() >= k).map(e -> e.getKey()).collect(Collectors.toSet()));
}
@Benchmark
public void doubleStreamParallel(Blackhole bh) {
bh.consume(input.stream().parallel().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
.entrySet().stream().parallel().filter(e -> e.getValue() >= k).map(e -> e.getKey())
.collect(Collectors.toSet()));
}
}
# JMH 1.9 (released 42 days ago)
# VM invoker: C:\Program Files\Java\jre1.9.0\bin\java.exe
# VM options: <none>
...
# Run complete. Total time: 01:00:24
Benchmark (k) (n) (profile) Mode Cnt Score Error Units
DistinctTest.distinct 2 100 distinct avgt 20 10.076 ± 0.707 us/op
DistinctTest.distinct 2 100 few avgt 20 6.505 ± 0.454 us/op
DistinctTest.distinct 2 100 many avgt 20 2.480 ± 0.366 us/op
DistinctTest.distinct 2 100 sorted avgt 20 4.435 ± 0.416 us/op
DistinctTest.distinct 2 100 withnulls avgt 20 3.071 ± 0.305 us/op
DistinctTest.distinct 2 10000 distinct avgt 20 862.703 ± 7.279 us/op
DistinctTest.distinct 2 10000 few avgt 20 989.554 ± 26.188 us/op
DistinctTest.distinct 2 10000 many avgt 20 325.408 ± 34.653 us/op
DistinctTest.distinct 2 10000 sorted avgt 20 518.308 ± 39.317 us/op
DistinctTest.distinct 2 10000 withnulls avgt 20 493.513 ± 8.385 us/op
DistinctTest.distinct 2 1000000 distinct avgt 20 272627.108 ± 22561.109 us/op
DistinctTest.distinct 2 1000000 few avgt 20 275581.769 ± 8012.608 us/op
DistinctTest.distinct 2 1000000 many avgt 20 44797.018 ± 3141.061 us/op
DistinctTest.distinct 2 1000000 sorted avgt 20 48971.547 ± 2462.198 us/op
DistinctTest.distinct 2 1000000 withnulls avgt 20 127426.192 ± 3134.266 us/op
DistinctTest.distinct 4 100 distinct avgt 20 10.091 ± 0.712 us/op
DistinctTest.distinct 4 100 few avgt 20 6.306 ± 0.449 us/op
DistinctTest.distinct 4 100 many avgt 20 2.452 ± 0.343 us/op
DistinctTest.distinct 4 100 sorted avgt 20 4.157 ± 0.430 us/op
DistinctTest.distinct 4 100 withnulls avgt 20 3.029 ± 0.322 us/op
DistinctTest.distinct 4 10000 distinct avgt 20 857.569 ± 5.606 us/op
DistinctTest.distinct 4 10000 few avgt 20 866.982 ± 2.292 us/op
DistinctTest.distinct 4 10000 many avgt 20 317.067 ± 39.232 us/op
DistinctTest.distinct 4 10000 sorted avgt 20 514.381 ± 46.452 us/op
DistinctTest.distinct 4 10000 withnulls avgt 20 453.092 ± 4.472 us/op
DistinctTest.distinct 4 1000000 distinct avgt 20 263676.479 ± 8413.303 us/op
DistinctTest.distinct 4 1000000 few avgt 20 247033.407 ± 5212.887 us/op
DistinctTest.distinct 4 1000000 many avgt 20 43873.780 ± 3201.061 us/op
DistinctTest.distinct 4 1000000 sorted avgt 20 46622.925 ± 2618.410 us/op
DistinctTest.distinct 4 1000000 withnulls avgt 20 109429.434 ± 2231.328 us/op
DistinctTest.distinct2 2 100 distinct avgt 20 2.426 ± 0.027 us/op
DistinctTest.distinct2 2 100 few avgt 20 2.342 ± 0.010 us/op
DistinctTest.distinct2 2 100 many avgt 20 1.717 ± 0.005 us/op
DistinctTest.distinct2 2 100 sorted avgt 20 2.426 ± 0.014 us/op
DistinctTest.distinct2 2 100 withnulls avgt 20 1.996 ± 0.013 us/op
DistinctTest.distinct2 2 10000 distinct avgt 20 405.112 ± 3.743 us/op
DistinctTest.distinct2 2 10000 few avgt 20 493.997 ± 1.463 us/op
DistinctTest.distinct2 2 10000 many avgt 20 234.610 ± 1.045 us/op
DistinctTest.distinct2 2 10000 sorted avgt 20 278.096 ± 0.783 us/op
DistinctTest.distinct2 2 10000 withnulls avgt 20 350.004 ± 0.663 us/op
DistinctTest.distinct2 2 1000000 distinct avgt 20 180560.561 ± 6924.590 us/op
DistinctTest.distinct2 2 1000000 few avgt 20 202522.457 ± 5445.315 us/op
DistinctTest.distinct2 2 1000000 many avgt 20 35725.085 ± 1675.569 us/op
DistinctTest.distinct2 2 1000000 sorted avgt 20 32661.395 ± 651.902 us/op
DistinctTest.distinct2 2 1000000 withnulls avgt 20 123620.698 ± 11722.027 us/op
DistinctTest.distinct2 4 100 distinct avgt 20 2.427 ± 0.022 us/op
DistinctTest.distinct2 4 100 few avgt 20 1.980 ± 0.009 us/op
DistinctTest.distinct2 4 100 many avgt 20 1.716 ± 0.004 us/op
DistinctTest.distinct2 4 100 sorted avgt 20 2.218 ± 0.018 us/op
DistinctTest.distinct2 4 100 withnulls avgt 20 1.883 ± 0.010 us/op
DistinctTest.distinct2 4 10000 distinct avgt 20 409.476 ± 0.764 us/op
DistinctTest.distinct2 4 10000 few avgt 20 431.062 ± 1.121 us/op
DistinctTest.distinct2 4 10000 many avgt 20 238.471 ± 0.502 us/op
DistinctTest.distinct2 4 10000 sorted avgt 20 265.066 ± 4.045 us/op
DistinctTest.distinct2 4 10000 withnulls avgt 20 311.112 ± 2.412 us/op
DistinctTest.distinct2 4 1000000 distinct avgt 20 177993.057 ± 5737.694 us/op
DistinctTest.distinct2 4 1000000 few avgt 20 187580.324 ± 2032.904 us/op
DistinctTest.distinct2 4 1000000 many avgt 20 35414.346 ± 1489.152 us/op
DistinctTest.distinct2 4 1000000 sorted avgt 20 31047.504 ± 326.305 us/op
DistinctTest.distinct2 4 1000000 withnulls avgt 20 107941.419 ± 1642.979 us/op
DistinctTest.distinct2Parallel 2 100 distinct avgt 20 20.509 ± 0.655 us/op
DistinctTest.distinct2Parallel 2 100 few avgt 20 18.130 ± 0.481 us/op
DistinctTest.distinct2Parallel 2 100 many avgt 20 17.524 ± 0.280 us/op
DistinctTest.distinct2Parallel 2 100 sorted avgt 20 11.909 ± 0.200 us/op
DistinctTest.distinct2Parallel 2 100 withnulls avgt 20 9.849 ± 0.316 us/op
DistinctTest.distinct2Parallel 2 10000 distinct avgt 20 711.803 ± 9.197 us/op
DistinctTest.distinct2Parallel 2 10000 few avgt 20 805.113 ± 9.221 us/op
DistinctTest.distinct2Parallel 2 10000 many avgt 20 287.951 ± 5.080 us/op
DistinctTest.distinct2Parallel 2 10000 sorted avgt 20 349.457 ± 1.975 us/op
DistinctTest.distinct2Parallel 2 10000 withnulls avgt 20 442.185 ± 3.532 us/op
DistinctTest.distinct2Parallel 2 1000000 distinct avgt 20 84722.555 ± 1663.882 us/op
DistinctTest.distinct2Parallel 2 1000000 few avgt 20 115307.445 ± 4861.937 us/op
DistinctTest.distinct2Parallel 2 1000000 many avgt 20 24850.287 ± 296.845 us/op
DistinctTest.distinct2Parallel 2 1000000 sorted avgt 20 38884.098 ± 1331.486 us/op
DistinctTest.distinct2Parallel 2 1000000 withnulls avgt 20 70291.310 ± 1638.556 us/op
DistinctTest.distinct2Parallel 4 100 distinct avgt 20 20.680 ± 0.843 us/op
DistinctTest.distinct2Parallel 4 100 few avgt 20 17.265 ± 0.495 us/op
DistinctTest.distinct2Parallel 4 100 many avgt 20 17.733 ± 0.293 us/op
DistinctTest.distinct2Parallel 4 100 sorted avgt 20 11.569 ± 0.248 us/op
DistinctTest.distinct2Parallel 4 100 withnulls avgt 20 9.673 ± 0.233 us/op
DistinctTest.distinct2Parallel 4 10000 distinct avgt 20 711.795 ± 10.728 us/op
DistinctTest.distinct2Parallel 4 10000 few avgt 20 705.210 ± 15.654 us/op
DistinctTest.distinct2Parallel 4 10000 many avgt 20 288.444 ± 2.685 us/op
DistinctTest.distinct2Parallel 4 10000 sorted avgt 20 321.868 ± 4.717 us/op
DistinctTest.distinct2Parallel 4 10000 withnulls avgt 20 379.891 ± 8.331 us/op
DistinctTest.distinct2Parallel 4 1000000 distinct avgt 20 88958.429 ± 4647.219 us/op
DistinctTest.distinct2Parallel 4 1000000 few avgt 20 83954.803 ± 2336.181 us/op
DistinctTest.distinct2Parallel 4 1000000 many avgt 20 25665.085 ± 1324.138 us/op
DistinctTest.distinct2Parallel 4 1000000 sorted avgt 20 33023.539 ± 1016.088 us/op
DistinctTest.distinct2Parallel 4 1000000 withnulls avgt 20 48519.962 ± 1402.775 us/op
DistinctTest.distinctParallel 2 100 distinct avgt 20 20.999 ± 1.341 us/op
DistinctTest.distinctParallel 2 100 few avgt 20 18.023 ± 0.298 us/op
DistinctTest.distinctParallel 2 100 many avgt 20 17.466 ± 0.287 us/op
DistinctTest.distinctParallel 2 100 sorted avgt 20 12.062 ± 0.240 us/op
DistinctTest.distinctParallel 2 100 withnulls avgt 20 9.908 ± 0.185 us/op
DistinctTest.distinctParallel 2 10000 distinct avgt 20 696.101 ± 5.631 us/op
DistinctTest.distinctParallel 2 10000 few avgt 20 810.674 ± 12.759 us/op
DistinctTest.distinctParallel 2 10000 many avgt 20 289.943 ± 3.148 us/op
DistinctTest.distinctParallel 2 10000 sorted avgt 20 340.911 ± 3.259 us/op
DistinctTest.distinctParallel 2 10000 withnulls avgt 20 426.310 ± 2.989 us/op
DistinctTest.distinctParallel 2 1000000 distinct avgt 20 93505.549 ± 6982.900 us/op
DistinctTest.distinctParallel 2 1000000 few avgt 20 117612.706 ± 5353.843 us/op
DistinctTest.distinctParallel 2 1000000 many avgt 20 22039.303 ± 406.431 us/op
DistinctTest.distinctParallel 2 1000000 sorted avgt 20 38088.294 ± 1440.017 us/op
DistinctTest.distinctParallel 2 1000000 withnulls avgt 20 73036.837 ± 4027.681 us/op
DistinctTest.distinctParallel 4 100 distinct avgt 20 20.429 ± 0.700 us/op
DistinctTest.distinctParallel 4 100 few avgt 20 17.273 ± 0.524 us/op
DistinctTest.distinctParallel 4 100 many avgt 20 17.867 ± 0.986 us/op
DistinctTest.distinctParallel 4 100 sorted avgt 20 11.636 ± 0.264 us/op
DistinctTest.distinctParallel 4 100 withnulls avgt 20 9.702 ± 0.223 us/op
DistinctTest.distinctParallel 4 10000 distinct avgt 20 717.174 ± 11.273 us/op
DistinctTest.distinctParallel 4 10000 few avgt 20 685.210 ± 3.885 us/op
DistinctTest.distinctParallel 4 10000 many avgt 20 291.187 ± 5.435 us/op
DistinctTest.distinctParallel 4 10000 sorted avgt 20 321.330 ± 5.761 us/op
DistinctTest.distinctParallel 4 10000 withnulls avgt 20 371.898 ± 1.292 us/op
DistinctTest.distinctParallel 4 1000000 distinct avgt 20 90384.072 ± 8515.771 us/op
DistinctTest.distinctParallel 4 1000000 few avgt 20 85288.065 ± 3161.993 us/op
DistinctTest.distinctParallel 4 1000000 many avgt 20 22583.471 ± 699.742 us/op
DistinctTest.distinctParallel 4 1000000 sorted avgt 20 32784.937 ± 915.522 us/op
DistinctTest.distinctParallel 4 1000000 withnulls avgt 20 47008.062 ± 1082.374 us/op
DistinctTest.doubleStream 2 100 distinct avgt 20 4.095 ± 0.064 us/op
DistinctTest.doubleStream 2 100 few avgt 20 3.925 ± 0.098 us/op
DistinctTest.doubleStream 2 100 many avgt 20 2.054 ± 0.007 us/op
DistinctTest.doubleStream 2 100 sorted avgt 20 3.039 ± 0.023 us/op
DistinctTest.doubleStream 2 10000 distinct avgt 20 796.422 ± 3.384 us/op
DistinctTest.doubleStream 2 10000 few avgt 20 878.811 ± 7.690 us/op
DistinctTest.doubleStream 2 10000 many avgt 20 239.245 ± 4.190 us/op
DistinctTest.doubleStream 2 10000 sorted avgt 20 359.577 ± 13.838 us/op
DistinctTest.doubleStream 2 1000000 distinct avgt 20 297502.091 ± 6341.697 us/op
DistinctTest.doubleStream 2 1000000 few avgt 20 318173.650 ± 12241.314 us/op
DistinctTest.doubleStream 2 1000000 many avgt 20 37241.274 ± 1765.361 us/op
DistinctTest.doubleStream 2 1000000 sorted avgt 20 42295.708 ± 483.627 us/op
DistinctTest.doubleStream 4 100 distinct avgt 20 4.162 ± 0.119 us/op
DistinctTest.doubleStream 4 100 few avgt 20 3.366 ± 0.050 us/op
DistinctTest.doubleStream 4 100 many avgt 20 2.071 ± 0.025 us/op
DistinctTest.doubleStream 4 100 sorted avgt 20 2.859 ± 0.029 us/op
DistinctTest.doubleStream 4 10000 distinct avgt 20 792.121 ± 11.065 us/op
DistinctTest.doubleStream 4 10000 few avgt 20 802.714 ± 3.399 us/op
DistinctTest.doubleStream 4 10000 many avgt 20 226.410 ± 0.515 us/op
DistinctTest.doubleStream 4 10000 sorted avgt 20 344.411 ± 3.103 us/op
DistinctTest.doubleStream 4 1000000 distinct avgt 20 299257.530 ± 8392.674 us/op
DistinctTest.doubleStream 4 1000000 few avgt 20 298183.049 ± 4541.512 us/op
DistinctTest.doubleStream 4 1000000 many avgt 20 35402.361 ± 342.813 us/op
DistinctTest.doubleStream 4 1000000 sorted avgt 20 40211.781 ± 426.403 us/op
DistinctTest.doubleStreamParallel 2 100 distinct avgt 20 16.478 ± 0.126 us/op
DistinctTest.doubleStreamParallel 2 100 few avgt 20 15.994 ± 0.338 us/op
DistinctTest.doubleStreamParallel 2 100 many avgt 20 9.167 ± 0.468 us/op
DistinctTest.doubleStreamParallel 2 100 sorted avgt 20 13.048 ± 0.128 us/op
DistinctTest.doubleStreamParallel 2 10000 distinct avgt 20 942.248 ± 14.524 us/op
DistinctTest.doubleStreamParallel 2 10000 few avgt 20 985.931 ± 5.406 us/op
DistinctTest.doubleStreamParallel 2 10000 many avgt 20 132.838 ± 0.939 us/op
DistinctTest.doubleStreamParallel 2 10000 sorted avgt 20 303.148 ± 2.546 us/op
DistinctTest.doubleStreamParallel 2 1000000 distinct avgt 20 294226.521 ± 15303.996 us/op
DistinctTest.doubleStreamParallel 2 1000000 few avgt 20 336986.741 ± 13510.120 us/op
DistinctTest.doubleStreamParallel 2 1000000 many avgt 20 35760.574 ± 638.865 us/op
DistinctTest.doubleStreamParallel 2 1000000 sorted avgt 20 41899.403 ± 741.789 us/op
DistinctTest.doubleStreamParallel 4 100 distinct avgt 20 16.196 ± 0.147 us/op
DistinctTest.doubleStreamParallel 4 100 few avgt 20 15.647 ± 0.129 us/op
DistinctTest.doubleStreamParallel 4 100 many avgt 20 9.162 ± 0.525 us/op
DistinctTest.doubleStreamParallel 4 100 sorted avgt 20 12.773 ± 0.147 us/op
DistinctTest.doubleStreamParallel 4 10000 distinct avgt 20 922.054 ± 13.214 us/op
DistinctTest.doubleStreamParallel 4 10000 few avgt 20 908.412 ± 15.561 us/op
DistinctTest.doubleStreamParallel 4 10000 many avgt 20 133.203 ± 0.578 us/op
DistinctTest.doubleStreamParallel 4 10000 sorted avgt 20 273.842 ± 5.564 us/op
DistinctTest.doubleStreamParallel 4 1000000 distinct avgt 20 297903.511 ± 12926.636 us/op
DistinctTest.doubleStreamParallel 4 1000000 few avgt 20 306296.716 ± 7673.998 us/op
DistinctTest.doubleStreamParallel 4 1000000 many avgt 20 36334.204 ± 458.981 us/op
DistinctTest.doubleStreamParallel 4 1000000 sorted avgt 20 36112.794 ± 930.054 us/op
DistinctTest.removeIf 2 100 distinct avgt 20 4.602 ± 0.033 us/op
DistinctTest.removeIf 2 100 few avgt 20 3.695 ± 0.013 us/op
DistinctTest.removeIf 2 100 many avgt 20 1.908 ± 0.007 us/op
DistinctTest.removeIf 2 100 sorted avgt 20 2.323 ± 0.014 us/op
DistinctTest.removeIf 2 10000 distinct avgt 20 861.065 ± 7.552 us/op
DistinctTest.removeIf 2 10000 few avgt 20 821.471 ± 6.357 us/op
DistinctTest.removeIf 2 10000 many avgt 20 213.615 ± 0.886 us/op
DistinctTest.removeIf 2 10000 sorted avgt 20 274.142 ± 0.655 us/op
DistinctTest.removeIf 2 1000000 distinct avgt 20 414877.809 ± 14113.968 us/op
DistinctTest.removeIf 2 1000000 few avgt 20 384176.577 ± 16784.865 us/op
DistinctTest.removeIf 2 1000000 many avgt 20 34567.374 ± 206.696 us/op
DistinctTest.removeIf 2 1000000 sorted avgt 20 34367.381 ± 404.604 us/op
DistinctTest.removeIf 4 100 distinct avgt 20 4.575 ± 0.033 us/op
DistinctTest.removeIf 4 100 few avgt 20 3.626 ± 0.008 us/op
DistinctTest.removeIf 4 100 many avgt 20 1.904 ± 0.004 us/op
DistinctTest.removeIf 4 100 sorted avgt 20 2.442 ± 0.036 us/op
DistinctTest.removeIf 4 10000 distinct avgt 20 859.452 ± 4.828 us/op
DistinctTest.removeIf 4 10000 few avgt 20 804.396 ± 7.711 us/op
DistinctTest.removeIf 4 10000 many avgt 20 211.545 ± 0.836 us/op
DistinctTest.removeIf 4 10000 sorted avgt 20 301.254 ± 5.309 us/op
DistinctTest.removeIf 4 1000000 distinct avgt 20 410370.939 ± 12232.423 us/op
DistinctTest.removeIf 4 1000000 few avgt 20 386061.753 ± 12803.511 us/op
DistinctTest.removeIf 4 1000000 many avgt 20 34664.094 ± 182.680 us/op
DistinctTest.removeIf 4 1000000 sorted avgt 20 36208.008 ± 459.616 us/op
DistinctTest.removeIfParallel 2 100 distinct avgt 20 11.891 ± 0.091 us/op
DistinctTest.removeIfParallel 2 100 few avgt 20 11.277 ± 0.167 us/op
DistinctTest.removeIfParallel 2 100 many avgt 20 6.196 ± 0.052 us/op
DistinctTest.removeIfParallel 2 100 sorted avgt 20 7.514 ± 0.066 us/op
DistinctTest.removeIfParallel 2 10000 distinct avgt 20 1107.195 ± 5.964 us/op
DistinctTest.removeIfParallel 2 10000 few avgt 20 1060.832 ± 5.002 us/op
DistinctTest.removeIfParallel 2 10000 many avgt 20 127.793 ± 1.925 us/op
DistinctTest.removeIfParallel 2 10000 sorted avgt 20 214.446 ± 2.905 us/op
DistinctTest.removeIfParallel 2 1000000 distinct avgt 20 362844.116 ± 9572.428 us/op
DistinctTest.removeIfParallel 2 1000000 few avgt 20 371892.016 ± 9150.527 us/op
DistinctTest.removeIfParallel 2 1000000 many avgt 20 34755.349 ± 278.747 us/op
DistinctTest.removeIfParallel 2 1000000 sorted avgt 20 29565.659 ± 748.929 us/op
DistinctTest.removeIfParallel 4 100 distinct avgt 20 11.746 ± 0.077 us/op
DistinctTest.removeIfParallel 4 100 few avgt 20 11.106 ± 0.134 us/op
DistinctTest.removeIfParallel 4 100 many avgt 20 6.203 ± 0.074 us/op
DistinctTest.removeIfParallel 4 100 sorted avgt 20 7.703 ± 0.196 us/op
DistinctTest.removeIfParallel 4 10000 distinct avgt 20 1100.511 ± 7.610 us/op
DistinctTest.removeIfParallel 4 10000 few avgt 20 1069.192 ± 25.016 us/op
DistinctTest.removeIfParallel 4 10000 many avgt 20 126.637 ± 1.378 us/op
DistinctTest.removeIfParallel 4 10000 sorted avgt 20 235.656 ± 2.833 us/op
DistinctTest.removeIfParallel 4 1000000 distinct avgt 20 362334.487 ± 7654.813 us/op
DistinctTest.removeIfParallel 4 1000000 few avgt 20 389090.919 ± 12011.139 us/op
DistinctTest.removeIfParallel 4 1000000 many avgt 20 34483.254 ± 289.400 us/op
DistinctTest.removeIfParallel 4 1000000 sorted avgt 20 33013.028 ± 2905.069 us/op
|Sequential |Parallel
(k) (n) (profile)|spliterator filter two-streams remove-if|spliterator filter two-streams remove-if
-------------------------------------------------------------------------------------------------------------
2 100 distinct | 2.43 10.08 4.10 4.60| 20.51 21.00 16.48 11.89
4 100 distinct | 2.43 10.09 4.16 4.58| 20.68 20.43 16.20 11.75
2 10000 distinct | 405.11 862.70 796.42 861.07| 711.80 696.10 942.25 1107.20
4 10000 distinct | 409.48 857.57 792.12 859.45| 711.80 717.17 922.05 1100.51
2 1000000 distinct | 180560.56 272627.11 297502.09 414877.81| 84722.56 93505.55 294226.52 362844.12
4 1000000 distinct | 177993.06 263676.48 299257.53 410370.94| 88958.43 90384.07 297903.51 362334.49
2 100 few | 2.34 6.51 3.93 3.70| 18.13 18.02 15.99 11.28
4 100 few | 1.98 6.31 3.37 3.63| 17.27 17.27 15.65 11.11
2 10000 few | 494.00 989.55 878.81 821.47| 805.11 810.67 985.93 1060.83
4 10000 few | 431.06 866.98 802.71 804.40| 705.21 685.21 908.41 1069.19
2 1000000 few | 202522.46 275581.77 318173.65 384176.58| 115307.45 117612.71 336986.74 371892.02
4 1000000 few | 187580.32 247033.41 298183.05 386061.75| 83954.80 85288.07 306296.72 389090.92
2 100 many | 1.72 2.48 2.05 1.91| 17.52 17.47 9.17 6.20
4 100 many | 1.72 2.45 2.07 1.90| 17.73 17.87 9.16 6.20
2 10000 many | 234.61 325.41 239.25 213.62| 287.95 289.94 132.84 127.79
4 10000 many | 238.47 317.07 226.41 211.55| 288.44 291.19 133.20 126.64
2 1000000 many | 35725.09 44797.02 37241.27 34567.37| 24850.29 22039.30 35760.57 34755.35
4 1000000 many | 35414.35 43873.78 35402.36 34664.09| 25665.09 22583.47 36334.20 34483.25
2 100 sorted | 2.43 4.44 3.04 2.32| 11.91 12.06 13.05 7.51
4 100 sorted | 2.22 4.16 2.86 2.44| 11.57 11.64 12.77 7.70
2 10000 sorted | 278.10 518.31 359.58 274.14| 349.46 340.91 303.15 214.45
4 10000 sorted | 265.07 514.38 344.41 301.25| 321.87 321.33 273.84 235.66
2 1000000 sorted | 32661.40 48971.55 42295.71 34367.38| 38884.10 38088.29 41899.40 29565.66
4 1000000 sorted | 31047.50 46622.93 40211.78 36208.01| 33023.54 32784.94 36112.79 33013.03
2 100 withnulls| 2.00 3.07 | 9.85 9.91
4 100 withnulls| 1.88 3.03 | 9.67 9.70
2 10000 withnulls| 350.00 493.51 | 442.19 426.31
4 10000 withnulls| 311.11 453.09 | 379.89 371.90
2 1000000 withnulls| 123620.70 127426.19 | 70291.31 73036.84
4 1000000 withnulls| 107941.42 109429.43 | 48519.96 47008.06
-------------------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment