-
Notifications
You must be signed in to change notification settings - Fork 301
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
Remove Unsafe Blocks #195
Comments
I managed to remove many unsafe blocks in #208 . Most of the remaining ones are due to the usage of The remaining |
How could I say no? 😉 But yes, indeed, those look like prime candidates for parallel iterators. If you wanted to get fancy, those |
I've tried using Rayon there, in fact. It was a while ago, though, so it might work better now. The problem I ran into is that, well, some of that code is super complex (I'm looking at Anyway, perhaps you folks will have more success than I did. I always meant to rip that code out and replace it with something more maintainable, but I didn't want to make it much slower. I think I might have to compromise on the performance (accept the cost of creating a new RNG for each iteration) or the generality (stop trying to be generic over the number of outputs and unzip them explicitly elsewhere). |
FWIW I gave it a quick shot too, and decided that it was tricky enough to deserve its own PR. I started with crossbeam, but while making the changes got the feeling that rayon might actually be enough. |
I'm hoping that rayon-rs/rayon#602 will help this kind of use case. |
That does look like it would help, yes. |
This does not seem to result in any regressions in performance, and possibly some small (~5%) speed-ups. This is technically a breaking change, as it required adding some trait bounds to some functions, but anyone that is actually broken risks having memory unsafety (non-`Send` types being sent across threads). Work towards bheisler#195.
This does not seem to result in any regressions in performance, and possibly some small (~5%) speed-ups. This is technically a breaking change, as it required adding some trait bounds to some functions, but anyone that is actually broken risks having memory unsafety (non-`Send` types being sent across threads). Work towards bheisler#195.
Status update. Criterion contains 10
|
The |
There are a lot of old
unsafe
blocks in Criterion.rs' internals. Many of them were written to work around compiler bugs or missing features that have since been fixed (see #188 (comment)). These should be cleaned up.There are a few others that might be harder to remove without impacting analysis performance in the bootstrapping code. I've tried several times to remove these without much success so far.
The text was updated successfully, but these errors were encountered: