Drop custom implementation of Fiber::ExecutionContext::Concurrent#16135
Merged
straight-shoota merged 3 commits intocrystal-lang:masterfrom Sep 11, 2025
Conversation
straight-shoota
approved these changes
Sep 5, 2025
mverzilli
approved these changes
Sep 6, 2025
mverzilli
left a comment
There was a problem hiding this comment.
Gotta love those removed / added line ratios 😍
Collaborator
Author
|
NOTE: since the class overrides |
straight-shoota
added a commit
that referenced
this pull request
Sep 15, 2025
The concurrent context doesn't exhibit any performance improvement over the parallel context (see #16135). So we may as well use a parallel context as default context, and allow resizing it for more parallelism (see #15956). The default configuration is without parallelism (MT:1), thus the execution context remains concurrent only, which is backward compatible (nothing changes). Resizing the context to enable parallelism will be at the discretion of the application: it can keep using the `CRYSTAL_WORKERS` environment variable, and/or fallback to the number of CPUs or use a hardcoded value, and/or provide a command line argument, or anything else. Co-authored-by: Johannes Müller <straightshoota@gmail.com>
ysbaddaden
added a commit
to ysbaddaden/crystal
that referenced
this pull request
Oct 9, 2025
straight-shoota
added a commit
that referenced
this pull request
Oct 13, 2025
Co-authored-by: Johannes Müller <straightshoota@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Concurrentimplementation mostly duplicates theParallelone, and the parallel schedulers now take a few shortcuts when parallelism is set to 1 (skip stealing, quick evloop check) andConcurrentdoesn't exhibit any noticeable performance improvement overParallel.Having a single implementation instead of two, almost identical, will ease maintenance.
I kept the type and didn't deprecate it yet. It's only value is that you can't mistakenly resize the context and an exception is raised when you try to (related to #15956).