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

2020-12-16 16:51:11 +08:00
 yuhangch
迫于不会发图,文字描述一下:

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

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

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

很疑惑,这两个环境都在 ubuntu 里跑的,感觉挺玄学的,有没有大佬能帮分析下,(我自己再去测测)
1176 次点击
所在节点    Python
3 条回复
jmc891205
2020-12-16 17:12:02 +08:00
python 版本
package 的版本
yuhangch
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
2020-12-16 17:51:48 +08:00
@jmc891205 感谢,又仔细比对了一遍,是有个包版本的问题

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/736079

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX