1
JhZ7z587cYROBgVQ 2016-05-29 10:03:01 +08:00
不是说 2.2 还是哪个版本有一个去 gil 的分支么,然后测下来性能反而更悲剧了
|
2
congeec 2016-05-29 10:17:22 +08:00
消息刚出,反应还不是很热烈
等会 Slideshare 上有了 PPT , Hack News 上面有讨论就好玩儿了 |
3
2225377fjs 2016-05-29 12:36:30 +08:00
去 GIL , Python 生产环境会有更多的坑的, Java 踩过的坑 Python 都会再踩一遍, Java 发展了这么多年才有现在稳定的并行架构, Python 也不太可能一蹴而就。 GIL 被吐槽了这么多年,要是真没了,还真有可能不习惯。
|
4
neoblackcap 2016-05-29 13:54:21 +08:00
GIL 出去不是什么大问题,性能下降有很多原因,不仅仅是 GIL 移除的问题。
移除 GIL 最大的问题是很有可能会引起现有的 c 扩展都挂了,因为那很有可能会改动 cpython 的 c api 。 其实按道理来说移除 GIL ,引入颗粒度更小的锁,用基于可达性分析的 GC 来替代朴素引用计数都基本上是现代高级语言的做法。 至于 Python 界不是没有移除 GIL 的实现,一个很好的例子就是 Pypy ,那个可是没有 GIL 的,性能杠杠,还能真多线程。 |
5
janxin OP @neoblackcap 如果我没记错 pypy 是有 GIL 的...
|
6
dreampuf 2016-05-29 14:18:25 +08:00
@neoblackcap
http://doc.pypy.org/en/latest/faq.html#does-pypy-have-a-gil-why > Does PyPy have a GIL? Why? > Yes, PyPy has a GIL. Removing the GIL is very hard. The problems are essentially the same as with CPython (including the fact that our garbage collectors are not thread-safe so far). Fixing it is possible, as shown by Jython and IronPython, but difficult. It would require adapting the whole source code of PyPy, including subtle decisions about whether some effects are ok or not for the user (i.e. the Python programmer). > Instead, since 2012, there is work going on on a still very experimental Software Transactional Memory (STM) version of PyPy. This should give an alternative PyPy which works without a GIL, while at the same time continuing to give the Python programmer the complete illusion of having one. |
7
neoblackcap 2016-05-29 14:19:50 +08:00
@janxin 对,刚查了一下, pypy 是有 GIL 的, pypy stm 才没有 GIL
|
8
janxin OP 演讲视频
|
9
v0768ex 2016-06-05 21:27:02 +08:00 via Android
去掉 gil 容易扯到蛋,几年内看不到希望。
|