-
Notifications
You must be signed in to change notification settings - Fork 144
switch from async to rayon [v3] #2173
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
base: release/v3
Are you sure you want to change the base?
Conversation
5396eee
to
7b718b8
Compare
@rvagg if this isn't easier to understand, it's not worth it. I thought it was going to be simpler, but error handling with rayon was surprisingly difficult. It might be better to re-try this with channels and a thread-pool, although error handling will still be tricky. My issue with async-await is that it comes with a bunch of sharp edges around moving things and the error messages can be cryptic. |
let file = File::open(&path)?; | ||
let reader = BufReader::new(file); | ||
|
||
// Test vectors have the form: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not understanding how all the code in this function manage to be get deleted in this refactor, what is rayon giving us that makes all of this go away? Or does the deletion come mainly from basic cleanup in the process?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of this code was duplicated from MessageVector::from_file
(not sure why). There's also some stuff here that makes it possible to configure test-vector runs with environment variables, but we've never really used them.
This all makes sense to me and is much simpler, but I'm not seeing the error handling difficulty this introduces, can you highlight that for me because it looks like normal rust shenanigans to my eyes. Is it the need for The biggest delta is that looking at the new code I'm having to take for granted that using a |
It's normal rust shenanigans. My hope was that rayon would have "try" versions of all their operations that could fail the pipeline early, but no such luck. The other way to do this is to manually spin up a worker pool and feed the workers with channels (go style). But I'm not sure if that'll be any better.
I'm not sure I understand:
Yeah, I verified it by logging. We get stuck compiling wasm modules then blow past once we're done.
I dug into this more and the issue is that:
This is apparently a well-known rayon issue with no good fix. I've tried some nasty yield hacks but... I only managed to shave off 2 seconds when I should be able to shave off 6. Let's chat about this in person. I think we may just need to shelve this for now. |
This switches from async rust to using rayon for conformance test parallelism. I'm making this PR against FVM v3 because we currently have conformance tests there.
Motivation:
Performance:
Overall, the conformance tests go from 6 to 12 seconds which isn't great (2x) but that extra time appears to be entirely "startup" cost and shouldn't scale with the number of tests.
fixes #2144