ox
ox copied to clipboard
Cancelling `CancellableFork` optimization
Benchmarking the new groupedWithin operator showed that cancelling CancellableFork that hasn't started yet can be optimized.
CancellableFork.cancelNow creates InterruptedException. I replaced that exception with no-stack-trace variant and observed an improvement.
Benchmark code:
supervised {
for (i <- 1 to 15) {
val c = Source.range(1, 1000000, 1)
val start = System.nanoTime()
c.groupedWithin(3, 1.second).drain()
val dur = System.nanoTime() - start
println(dur / 1000000)
}
Results (median):
- current solution: 2627 ms
- no-stack-trace variant: 1261 ms