-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: try eliding bounds checks when indexing (#51)
When indices are returned by the `Core::idx_gen` function, we can assume that they are in bounds, since any bits that would make the index out of bounds for the core's array size are masked out. Therefore, we can safely use `slice::get_unchecked` to elide bounds checks. In debug mode, we assert that the index is in bounds, just in case there's a bug somewhere. In conjunction with #50, this means MPSCs should never panic in release mode. Signed-off-by: Eliza Weisman <[email protected]>
- Loading branch information
Showing
2 changed files
with
41 additions
and
16 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