python3.7 使用 asyncio 和 aiohttp 从 URL 中批量提取标题
python3.7 bulk title extraction from URL's using asyncio and aiohttp
我想获取列表中所有网站的标题。
这就是我现在正在使用的
https://gist.github.com/PandaWhoCodes/e6a4621d3b09889a98d12e67bb8c4cf9
600 URL 的 运行 仍然需要 5 分钟。
有没有办法让这个过程更快?
您确实需要调试 and/or 配置文件网络部分。看起来您对 connections/bandwidth 有一些限制 — 可能是您的 ISP 或服务限制了您的请求。
您的代码完全没问题,几秒内即可完成。分析显示前 3 "own time" 个(本身消耗最多,没有调用链)节点是
- epoll select
- zlib 解压
bytes.decode
这是总运行时间的 ~50%。
我想获取列表中所有网站的标题。 这就是我现在正在使用的
https://gist.github.com/PandaWhoCodes/e6a4621d3b09889a98d12e67bb8c4cf9
600 URL 的 运行 仍然需要 5 分钟。 有没有办法让这个过程更快?
您确实需要调试 and/or 配置文件网络部分。看起来您对 connections/bandwidth 有一些限制 — 可能是您的 ISP 或服务限制了您的请求。
您的代码完全没问题,几秒内即可完成。分析显示前 3 "own time" 个(本身消耗最多,没有调用链)节点是
- epoll select
- zlib 解压
bytes.decode
这是总运行时间的 ~50%。