Closed hxyshare closed 4 years ago
Thanks for your work. 因为python是伪多线程,在_loop_collect_result(self)函数和finished = self._finish_event.wait(timeout)会因为线程切换而导致40ms的多余开销,请问有什么的好的方法可以解决这个问题吗?
_loop_collect_result(self)
finished = self._finish_event.wait(timeout)
你可以试试用gevent,参考这里:https://github.com/ShannonAI/service-streamer/blob/ebcc3724efc9789feb8980641533909798d4d6dc/example/flask_multigpu_example.py#L4
另外:40ms是不太make sense的开销(即使对python来说),建议可以重新测一下
谢谢回答
Thanks for your work. 因为python是伪多线程,在
_loop_collect_result(self)
函数和finished = self._finish_event.wait(timeout)
会因为线程切换而导致40ms的多余开销,请问有什么的好的方法可以解决这个问题吗?