-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat(multithread): add rayon & par_iter for multithreaded execution #180
base: main
Are you sure you want to change the base?
Conversation
…nto multithreaded
…nto multithreaded
Thanks for the PR!
|
I agree with what you are presenting, I actually started working on the second issue that you suggested, a little while before raising this PR, but sadly I wasn't able to include those changes in this PR at the moment. However, I am working on it and will add those changes to this branch. Speaking about the first issue that you mentioned, I was also trying to achieve the same, but to achieve the current performance on the binary, some of the functionality used cannot support multi-threading, I do acknowledge that this tradeoff had to be made but, wasn't able to test how much a performance bottleneck is caused by using Atomically safe wrappers. I'll try to benchmark it in the meantime, but theoretically, that will cause some performance bottleneck if the application is not running on the multithreaded mode as that is the intention of that change. Still, I'll try to find other ways to achieve something similar or to find a workaround for the feature-gated solution. |
I haven't measured this, but
|
Hello! I was wondering about this kind of functionality and came across this pr. I'm curious about it's status? I'm sure it would be super useful for projects with larger sets of features(where cargo-hack is needed the most!). |
Hey @Pat-Lafon, I wasn't able to pick up on the comments left by @taiki-e, but I am planning to pick it up as soon as possible. I was able to come up with a solution to unify the logs that the application will emit. But, haven't implemented it in this branch just yet. Will try to pick it up in the very near future. |
Description
This is a feature-gated implementation of multi-threading for this project. This utilizes
rayon
for performing multi-threading.This PR is raised against #128.
Reasoning
Following are some of the decisions taken while building the solution. Feel free to comment on any of them, as I might have missed something during the process.
Rc<T>
->Arc<T>
. While some might require multithreading others might want to go with the legacy implementation and I all the smart pointers are made to be thread-safe this could hamper the performance of the legacy implementation. This is avoided by using#[cfg(...
gates on variables and arguments.cargo
has in place. In order to do so multiple target directories were created and they were assigned for execution, as well as reused to take advantage of cachingrayon
had some added benefits. Being lightweight and guaranteeing data-race freedom, with the added benefit of having great abstraction.