Skip to content
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

Why not multithreading? #6

Open
ianni67 opened this issue May 2, 2020 · 2 comments
Open

Why not multithreading? #6

ianni67 opened this issue May 2, 2020 · 2 comments

Comments

@ianni67
Copy link

ianni67 commented May 2, 2020

I would suggest to change the socket communication to multithread processing, with a thread that computes the mask and the other that composes the mask with the background.
The overall computation speed and overload should improve dramatically.

@fiblan fiblan mentioned this issue May 2, 2020
@fiblan
Copy link
Owner

fiblan commented May 2, 2020

I could use multithreading if the two tasks were internal to the same process. But even then "compose" thread should still wait for the outcome of the "compute mask" thread, unless I calculate the "previous" mask... but I can improve socket communication with a more performant protocol as zerorpc (it builds on top of ZeroMQ and MessagePack), instead of bloated http protocol.

@ianni67
Copy link
Author

ianni67 commented May 2, 2020

Yes, indeed I meant a single process with two threads. This would imply porting the bodypix process to python. Not the easiest task, indeed.
Compose would not need to wait for compute_mask to deliver the updated mask: the synchronization between the processes would be non-blocking, and in case the new mask is not available yet, the previous one would be used.
The speedup obtained by multithreading would probably strongly reduce the probability of such a worst case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants