amaembo / streamex

Enhancing Java Stream API
Apache License 2.0
2.18k stars 249 forks source link

Refactor code of WithFirstSpliterator #232

Open naftalmm opened 4 years ago

naftalmm commented 4 years ago

Simplify the code of WithFirstSpliterator:

Tests are keep passing, perfomance is the same (even a bit higher):

Benchmark                                                  (N)   Mode  Cnt    Score    Error  Units
withFirst.WithFirstBenchmark.parallelNew                100000  thrpt   25  729,474 ± 40,193  ops/s
withFirst.WithFirstBenchmark.parallelOld                100000  thrpt   25  708,247 ± 22,885  ops/s
withFirst.WithFirstBenchmark.parallelNewShortCircuit    100000  thrpt   25  651,792 ± 19,253  ops/s
withFirst.WithFirstBenchmark.parallelOldShortCircuit    100000  thrpt   25  605,977 ±  4,831  ops/s
withFirst.WithFirstBenchmark.sequentialNew              100000  thrpt   25  845,432 ±  4,031  ops/s
withFirst.WithFirstBenchmark.sequentialOld              100000  thrpt   25  826,331 ±  3,419  ops/s
withFirst.WithFirstBenchmark.sequentialNewShortCircuit  100000  thrpt   25  432,279 ± 29,359  ops/s
withFirst.WithFirstBenchmark.sequentialOldShortCircuit  100000  thrpt   25  374,763 ± 27,017  ops/s

WithFirstSpliteratorOld class and new @Deprecated methods & benchmarks are subject for removal upon merging this PR.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-1.5%) to 98.209% when pulling f587da17570f81791e7120849a78a399a8c810c0 on naftalmm:refactor_withFirst into 2be61c5f5b6317b4c99f20aa55f06c7f0f877ec8 on amaembo:master.

loordgek commented 10 months ago

is this good now ?