V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
shade
V2EX  ›  Python

for 循环几千次做简单的计算任务算不算计算密集型任务?

  •  
  •   shade · 2014-08-08 11:03:17 +08:00 · 3040 次点击
    这是一个创建于 3547 天前的主题,其中的信息可能已经有所发展或是发生改变。
    5 条回复    2014-08-08 19:20:29 +08:00
    dong3580
        1
    dong3580  
       2014-08-08 11:13:04 +08:00
    表示已经死循环了好几个月,服务器依然正常ing。。。几千次怕啥,
    shade
        2
    shade  
    OP
       2014-08-08 11:17:29 +08:00   ❤️ 1
    在gevent碰到这种问题,会直接跑死,怎样在gevent中处理cpu-bound任务呢?
    hydrazt
        3
    hydrazt  
       2014-08-08 11:22:05 +08:00
    gevent处理io-bound,cpu-bound没必要gevent吧
    Mutoo
        4
    Mutoo  
       2014-08-08 12:58:19 +08:00
    又不是 O(n^k), k>2 怕啥
    Glow
        5
    Glow  
       2014-08-08 19:20:29 +08:00   ❤️ 1
    可以试一试 Duff's Device 来优化一下

    Duff's device - Wikipedia, the free encyclopedia http://en.wikipedia.org/wiki/Duff's_device
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2600 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 16:01 · PVG 00:01 · LAX 09:01 · JFK 12:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.