Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancelling CancellableFork optimization #161

Open
micossow opened this issue Jun 26, 2024 · 0 comments
Open

Cancelling CancellableFork optimization #161

micossow opened this issue Jun 26, 2024 · 0 comments

Comments

@micossow
Copy link
Contributor

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant