V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · Aug 8, 2014 · 3622 views
    This topic created in 4288 days ago, the information mentioned may be changed or developed.
    5 replies    2014-08-08 19:20:29 +08:00
    dong3580
        1
    dong3580  
       Aug 8, 2014
    表示已经死循环了好几个月,服务器依然正常ing。。。几千次怕啥,
    shade
        2
    shade  
    OP
       Aug 8, 2014   ❤️ 1
    在gevent碰到这种问题,会直接跑死,怎样在gevent中处理cpu-bound任务呢?
    hydrazt
        3
    hydrazt  
       Aug 8, 2014
    gevent处理io-bound,cpu-bound没必要gevent吧
    Mutoo
        4
    Mutoo  
       Aug 8, 2014
    又不是 O(n^k), k>2 怕啥
    Glow
        5
    Glow  
       Aug 8, 2014   ❤️ 1
    可以试一试 Duff's Device 来优化一下

    Duff's device - Wikipedia, the free encyclopedia http://en.wikipedia.org/wiki/Duff's_device
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   784 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 19:35 · PVG 03:35 · LAX 12:35 · JFK 15:35
    ♥ Do have faith in what you're doing.