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.
Async backend considerations:
concurrent-ruby
- thread-based, compatible with basically everything, including different Ruby implementations, provides thread-safe primitives (of questionable reliability, haha)async
- fiber-based, can be a little bit more performant thanconcurrent-ruby
(with correct setup), has worse compatibility with gems (especially the ones that incorporate C-extensions), as well as with alternative Ruby implementations, no thread-safe primitives out of the boxractors
- x2 faster than regular threads, more restrictive than Rust's borrow checker with lifetimes of mutable references in async fn's, not compatible with basically any of the popular gems, even with the standard ones likenet/http
, not compatible with C-extensionsAnd the winner is -
concurrent-ruby
.Though, there is really high temptation to throw it out in a favour of pure thread-based setup similar to the one used in
parallel
. Downside - no reusable pools. Upside - threads are killed after being used immediately, so no need to worry about thread pollution. Thing that should be tested first - how much thread allocation "on-demand" affect the performance.Async setup:
main
poolsync
mode); on the other hand, contract check completes much fastersampler
andlogger
under stress, technically they're still not fully thread-safe; possible solution - to move their initialisation from contract toMatcher
, so each check will work with its own isolated copies