[英]Difference in multithreading overhead between python 2.x and 3.x
I wrote some custom code that uses locks and condition variables, I observe significant difference in synchronisation overhead between Python 2.x and 3.x: 我编写了一些使用锁和条件变量的自定义代码,观察到Python 2.x和3.x之间的同步开销存在显着差异:
Is there a reason for this? 是否有一个原因? A well-known explanation?
一个著名的解释? A CPython bug only solved in 3.x?
仅在3.x中解决的CPython错误?
If someone knows the answer off the top of their head, it's most welcome. 如果有人从头顶上知道答案,那将是非常受欢迎的。
Otherwise leave a comment and I'll hack up some test code. 否则请发表评论,我将介绍一些测试代码。
They did a lot of work in 3.2 to improve multithreading performance and how the GIL functions: 他们在3.2中做了很多工作,以提高多线程性能以及GIL的功能:
http://docs.python.org/dev/whatsnew/3.2.html#multi-threading http://docs.python.org/dev/whatsnew/3.2.html#multi-threading
Without knowing anything else about your code, that'd be my guess. 在不了解您的代码的情况下,这就是我的猜测。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.