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
yuhangch
V2EX  ›  Python

同样的程序在 conda base 环境和其他环境运行效果不同

  •  
  •   yuhangch ·
    yuhangch · 2020-12-16 16:51:11 +08:00 · 1152 次点击
    这是一个创建于 1198 天前的主题,其中的信息可能已经有所发展或是发生改变。
    迫于不会发图,文字描述一下:

    程序是挺简单的一个 web 应用(用的 aiohttp ),里面有从磁盘读取图像的操作。

    在 base 环境下,大致计算了一下请求的执行时间为 0.1s 左右

    新建了一个环境 env2,相同的代码,每个请求的处理时间大致为 0.6s 左右,这种情况下,明显感觉到延时,看打印的记录感觉就像在串行。

    很疑惑,这两个环境都在 ubuntu 里跑的,感觉挺玄学的,有没有大佬能帮分析下,(我自己再去测测)
    jmc891205
        1
    jmc891205  
       2020-12-16 17:12:02 +08:00 via iPhone
    python 版本
    package 的版本
    yuhangch
        2
    yuhangch  
    OP
       2020-12-16 17:14:01 +08:00
    base 环境
    ```
    (base) git@Data_share:/mnt/e/viz-server/viz$ time python bench.py
    <class 'numpy.ndarray'>

    real 0m0.771s
    user 0m1.063s
    sys 0m1.781s

    (base) git@Data_share:/mnt/e/viz-server/viz$ python
    Python 3.8.5 (default, Sep 4 2020, 07:30:14)
    [GCC 7.3.0] :: Anaconda, Inc. on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> exit()

    (base) git@Data_share:/mnt/e/viz-server/viz$ pip list
    Package Version
    ---------------------- -------------------
    affine 2.3.0
    aiohttp 3.7.3
    aiohttp-cors 0.7.0
    async-timeout 3.0.1
    attrs 20.3.0
    boto3 1.16.35
    botocore 1.19.35
    brotlipy 0.7.0
    certifi 2020.6.20
    cffi 1.14.3
    chardet 3.0.4
    click 7.1.2
    click-plugins 1.1.1
    cligj 0.7.1
    conda 4.9.2
    conda-package-handling 1.7.2
    cryptography 3.2.1
    idna 2.10
    jmespath 0.10.0
    mercantile 1.1.6
    morecantile 2.0.1
    multidict 5.1.0
    numexpr 2.7.1
    numpy 1.19.4
    pip 20.2.4
    pycosat 0.6.3
    pycparser 2.20
    pydantic 1.7.3
    pyOpenSSL 19.1.0
    pyparsing 2.4.7
    PySocks 1.7.1
    python-dateutil 2.8.1
    python-dotenv 0.15.0
    rasterio 1.2a1
    redis 3.5.3
    requests 2.24.0
    rio-color 1.0.0
    rio-mucho 1.0.0
    rio-tiler 2.0.0rc3
    ruamel-yaml 0.15.87
    s3transfer 0.3.3
    setuptools 50.3.1.post20201107
    six 1.15.0
    snuggs 1.4.7
    tqdm 4.51.0
    typing-extensions 3.7.4.3
    urllib3 1.25.11
    wheel 0.35.1
    yarl 1.6.3
    ```
    yuhangch
        3
    yuhangch  
    OP
       2020-12-16 17:51:48 +08:00
    @jmc891205 感谢,又仔细比对了一遍,是有个包版本的问题
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3215 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 11:37 · PVG 19:37 · LAX 04:37 · JFK 07:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.