multiprocess or threading in python?

后端 未结 8 1863
我在风中等你
我在风中等你 2020-12-01 02:31

I have a python application that grabs a collection of data and for each piece of data in that collection it performs a task. The task takes some time to complete as there i

8条回答
  •  清歌不尽
    2020-12-01 02:49

    Using CPython's threading model will not give you any performance improvement, because the threads are not actually executed in parallel, due to the way garbage collection is handled. Multiprocess would allow parallel execution. Obviously in this case you have to have multiple cores available to farm out your parallel jobs to.

    There is much more information available in this related question.

提交回复
热议问题