1) 当你阻塞于os,如果你的代码在大量等待系统,GIL不会干扰你因为此时你没有编译python
字节码
2) 当你在简单执行内部指令时,比如操作大量字符串或者位运算。GIL不会产生干扰因为这些都
是作用于 字节码
3) 当你在执行C扩展模块。 Numpy,python图像库等。
4) 如果你真的依赖某段python代码。Cython也可以通过 with-statement 释放GIL
5) 如果不是C扩于展限制。Jython和Ironthon没有GIL
6) PyPy 也提高了之前受限于GIL的劣势。(但PyPy有自己的GIL)
1
denghongcai 2015-07-12 20:12:17 +08:00
这机翻的么?怎么都读不通顺
|
2
jackysc 2015-07-12 20:40:57 +08:00
老实说没看明白。。
|
3
janxin 2015-07-12 22:31:43 +08:00
看起来像个人的学习笔记
|
4
saber000 2015-07-13 12:00:31 +08:00 1
1) When you blocked in os, if your code is a lot of waiting for the system, GIL will not disturb you because at this time you do not have to compile python bytecode
2) When you instructions simple internal execution, such as operating a large number of string or bit computing. GIL interference will not occur because these are acting on the bytecode 3) When you execute a C extension module. Numpy, python image libraries. 4) If you really depend on certain python code. Cython may also release GIL through with-statement 5) If it is not expanded to show C limit. Jython and Ironthon no GIL 6) PyPy also improved the previous limited by GIL disadvantage. (But PyPy has its own GIL) |
6
jell OP @denghongcai 自己翻译的,比较粗糙。哈
|
9
janxin 2015-07-13 20:38:26 +08:00
|
10
saber000 2015-07-14 14:12:43 +08:00
|