-
Notifications
You must be signed in to change notification settings - Fork 113
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
Use Process
to actually run the task in multiple processes to speed up the performance
#64
base: main
Are you sure you want to change the base?
Conversation
…r custom schemes is often unexpected.
Fixed wrong variable name.
print("\n Starting ...") | ||
self.start_t = time() | ||
|
||
if self.use_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.
Due to the fact that I don't have enough time to convert all tasks to using the Process
. I converted the random_brute. That's why I need this flag
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.
It will be better if the value is declared in the if __name__ == "__main__":
and then passed to the class.
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 want use_process
to be used for this particular option. The rest should be used the old approach. Then, slowly we can migrate to the new approach.
If we move use_process
to the outside of the class, how can we switch and meet this expectation?
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 mean to share the values between speed()
and the rest.
The problem is that we need to measure the speed and display it. Thus, the current number should be shared to the speed()
function.
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 believe that the metrics are shared across the threads. It means that t1 = threading.Thread(target=obj.speed)
is able to display it correctly.
In details, these lines of code help to to share metrics between speed()
self.cur_n = self.manager.Value('i', 0)
self.start_t = self.manager.Value('i', 0)
Could you specify which information is not shown so that I can look deeper?
Please ignore the CodeFactor. It is an existing issue. I will try to improve it in the next coming PRs |
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'll check if it really works and merge soon.
Process
to actually run the task in multiple processors to speed up the performanceBefore
After
Issue Link