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

Investigate use of bytemuck #957

Closed
dhardy opened this issue Apr 1, 2020 · 6 comments
Closed

Investigate use of bytemuck #957

dhardy opened this issue Apr 1, 2020 · 6 comments

Comments

@dhardy
Copy link
Member

dhardy commented Apr 1, 2020

The bytemuck crate may be able to replace some uses of unsafe in Rand crates; see this post. Investigate.

Note however that even if it can, we may not wish to use it due to pressure to reduce dependencies.

@Shnatsel
Copy link
Contributor

Shnatsel commented Apr 4, 2020

In some cases you can rely on the optimizer instead of third-party crates, see e.g. #963

@Shnatsel
Copy link
Contributor

Shnatsel commented Apr 9, 2020

I've listed some code that could benefit from this here. It seems pulling in bytemuck as a dependency might not be necessary, the standard library on 1.34 might suffice.

@vks
Copy link
Collaborator

vks commented Aug 26, 2020

Most unsafe code is removed in #1011. However, there is one use case remaining (fill_via_chunks) where we could not make the safe code as fast as the unsafe code.

@dhardy
Copy link
Member Author

dhardy commented Oct 19, 2020

I'm not sure about that claim: I still count 11 uses of unsafe in rand, 3 in rand_core plus one in rand_chacha (though there will certainly be more in its dependencies). Anyone wish to investigate further before the next releases?

@dhardy
Copy link
Member Author

dhardy commented Nov 15, 2021

See also: #1180 (comment)

@vks
Copy link
Collaborator

vks commented Nov 2, 2023

We decided to go with zerocopy instead in #1349.

@vks vks closed this as completed Nov 2, 2023
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

No branches or pull requests

3 participants