-
Notifications
You must be signed in to change notification settings - Fork 132
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
Added multithreading to BinaryArithmetic to increase speed. #29
Conversation
This is great! Can you also take a look at other places where multithreading can be used to speed up things? For example, calculating |
Thank you! I definitely was planning on it. I just wanted to get a review on what I had already done to show the improvement and let you know that I was working on it. |
I attempted to add more threads for calculating prod variables and it seems that there is a bottleneck when it comes to spawning threads. After the first 4, the overhead cost of spawning threads causes a decrease in speed. |
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.
Just a small change and then it'll be good to merge.
std::thread t1(strip_leading_zeroes, std::ref(num1_high.value)); | ||
std::thread t2(strip_leading_zeroes, std::ref(num1_low.value)); | ||
std::thread t3(strip_leading_zeroes, std::ref(num2_high.value)); | ||
std::thread t4(strip_leading_zeroes, std::ref(num2_low.value)); |
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.
The threads t1
, t2
, ... aren't very descriptive and should be renamed to thread1
, thread2
, ...
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.
Added the fix :)
6bf4812
to
69dd72f
Compare
@KingAkeem I've updated the testing and build mechanism recently, so can you merge the recent changes to your branch and push it again to that we can if the build still fails (only 1 build, that uses GCC 8 and does coverage analysis should fail, the rest should pass). |
@KingAkeem Please merge with latest upstream (for the reason mentioned above) |
@faheel I've merged the recent changes and pushed the branch. Sorry about taking so long, I just saw your comment. |
Looks like on Linux we'll need to add What are your thoughts on this @KingAkeem? |
@faheel Is there no way to add the |
This PR references issue #21 I've added multithreading code for concurrently running four
strip_leading_zeroes
functions. This has reduced the test time of the BinaryArithemetic tests by 3x as much. I've attached some photos of comparison below:Before multithreading:
After multithreading: