Skip to content

Conversation

@ysbaddaden
Copy link
Contributor

@ysbaddaden ysbaddaden commented Jul 4, 2025

Brings an optimization from the Concurrent context to the Parallel context when the parallelism is set to 1: we can spare a switch to the scheduler's run loop fiber to (not so) quickly check the global queue and event loop.

With this, there's no noticeable speed difference between Concurrent and Parallel with a single scheduler in a few benchmarks, such as a swarm of fibers or a HTTP server.

Built on top of #15936.

@ysbaddaden ysbaddaden force-pushed the refactor/speed-up-parallel-context-quick-dequeue-on-mt1 branch from 98fffb9 to 9c8d561 Compare July 22, 2025 15:39
@ysbaddaden ysbaddaden marked this pull request as ready for review July 22, 2025 15:40
@straight-shoota straight-shoota changed the title Speed up Parallel::scheduler# quick_dequeue? when max=1 Speed up Parallel::Scheduler#quick_dequeue? for max=1 Jul 22, 2025
@straight-shoota straight-shoota added this to the 1.18.0 milestone Jul 22, 2025
@straight-shoota straight-shoota merged commit fd94e36 into crystal-lang:master Jul 23, 2025
40 checks passed
@github-project-automation github-project-automation bot moved this from Review to Done in Multi-threading Jul 23, 2025
@ysbaddaden ysbaddaden deleted the refactor/speed-up-parallel-context-quick-dequeue-on-mt1 branch July 24, 2025 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants