4

js 都有 worker 线程,什么时候 Python 也能增强一下线程?

 3 years ago
source link: https://www.v2ex.com/t/787433
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Python

js 都有 worker 线程,什么时候 Python 也能增强一下线程?

  James369 · 6 小时 29 分钟前 · 1174 次点击
js 脚本都有 WebWorkers 线程,让人心动。
WebWorkers 允许开发者把长时间运行和密集计算型的任务放在后台执行而不会阻塞 UI,这会使得应用程序运行得更加流畅。甚至可以用于复杂的 3D 运算任务。
同时,WebWorker 传参方式也兼顾了安全性,比如可以序列化后再传递,或者直接转移参数对象的所有权。

反观 Python,我还在纠结它的 GIL 全局锁,不知道怎么处理 CPU 密集型操作?。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK