Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: elide bounds checks in release mode #51

Merged
merged 3 commits into from
Mar 16, 2022
Merged

Conversation

hawkw
Copy link
Owner

@hawkw hawkw commented Mar 16, 2022

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]

@hawkw hawkw enabled auto-merge (squash) March 16, 2022 17:29
@hawkw hawkw merged commit 27ea0ec into main Mar 16, 2022
@hawkw hawkw deleted the eliza/elide-bounds-checks branch March 16, 2022 19:25
hawkw added a commit that referenced this pull request Mar 16, 2022
<a name="v0.1.1"></a>
### v0.1.1 (2022-03-16)

#### Performance

*   elide bounds checks when indexing (#51)
    ([27ea0ec](27ea0ec))
* **mpsc:**  remove panics from wait queue (#50)
  ([f61993f](f61993f))

#### Bug Fixes

* **mpsc:**  compilation error on macOS (#53)
  ([d0d0cd9](d0d0cd9),
  closes [#54](#54))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant