forked from rayon-rs/rayon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor scope latches to reduce matching
The former `enum ScopeLatch` forced a `match` during both `increment` and `set` (decrement), even though both variants only need to update an `AtomicUsize` most of the time. rayon-rs#1057 helped hide that for `increment`, but `set` branching still showed up in perf profiles. Now this is refactored to a unified `CountLatch` that has a direct field for its `counter` used in the frequent case, and then an internal enum for the one-time notification variants. Therefore, most of its updates will have no `match` reached at all. The only other use of the former `CountLatch` was the one-shot termination latch in `WorkerThread`, so that's now renamed to `OnceLatch`.
- Loading branch information
Showing
4 changed files
with
118 additions
and
168 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.