-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Reuse benchmark threads across runs #44
base: main
Are you sure you want to change the base?
Conversation
Instead of using a `thread::scope`, this implements a similar concept, but reusing a global list of threads.
I'm curious what the new |
I'm not a fan of relying on |
The effects on beforeafterI also agree that the current solution is neither very sound, nor nice. I’m tempted to just copy-paste the whole |
I was playing around with that a little, but
I agree. I tried to copy-paste at least that part from the std implementation, together with a bunch of |
Instead of using a
thread::scope
, this implements a similar concept, but reusing a global list of threads.The implementation spawns threads as needed and keeps them around. Tasks are submitted via channels, and results are received the same way.
A small piece of
unsafe
is used to cast away the lifetime of the task function (therecord_sample
closure references&self
).The fact that we execute this within a closure and have a scope guard should make sure that no task outlives the fn call, though I am not an expert on this :-)
Fixes #37