typelevel / typelevel/cats-effect

BoundedAsyncQueue performs poorly on Scala Native

Open
#4,465 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
2.2k
Forks
576
Avg merge
2d 11h
Merged PRs (30d)
18

Description

Some benchmarking by @lbialy (https://github.com/lbialy/ce-jvm-vs-sn) shows a CE application in Scala Native 0.5.8 with a single-producer/single-consumer queue use much worse performance than the JVM:

---------------------------------
mode         lto   gc          ms
---------------------------------
release-full full  immix     4846
jvm          n/a   n/a        283

This performance difference is erased if the queue capacity is set such that CE uses the concurrent queue implementation instead:

---------------------------------
mode         lto   gc          ms
---------------------------------
release-full full  immix      457
jvm          n/a   n/a        514

Profiling on MacOS shows significant time being spent on exception handling in the async queue's notifyOne implementation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the async queue's notifyOne implementation and reproduce the linked Scala Native benchmark for a single-producer/single-consumer queue. Use the linked profiling result to investigate exception-handling time, then compare performance with the concurrent queue implementation and confirm that the bounded queue no longer shows the reported regression.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.