How efficient is threading in Python?

后端 未结 6 2058
故里飘歌
故里飘歌 2020-12-16 00:44

I heard threading is not very efficient in Python (compared to other languages).

Is this true? If so, how can a Python programmer overcome this?

6条回答
  •  北海茫月
    2020-12-16 01:21

    One option is to use a different implementation of Python, like Jython or IronPython. That way, you still get the benefits of having the Python language without having to deal with the GIL. However, you wouldn't have the ability to use the CPython-only libraries.

    Another option is to use different constructs than threads. For example, if you use Stackless Python, Tasklets are an alternative.

提交回复
热议问题