My first solution:
while True:
doLongProcess()
# other statements
exitCondition()
This solution was running to much slow. So I tried below solution:
flag = 0
while True:
if flag == 5:
doLongProcess()
flag = 0
# other statements
flag += 1
exitCondition()
Instead of doing doLongProcess() every time I make it 1:5 ratio.
By applying this solution, execution speed speed up but at "every doLongProcess()" it slows down.
So my question is, Will thread programming help me in this scenario or not? If yes can you guide me a little?
Edit: doLongProcess() is processing image. If I tell you in short,
1.Load image from local storage
2.face_recognition library will find face location on that image
3.if face found: it will compare with previous data
4.Returns result