From 0da3850df9da535acc5601d5035437709af897b3 Mon Sep 17 00:00:00 2001 From: monosans Date: Tue, 10 May 2022 15:48:46 +0300 Subject: [PATCH] Add uvloop for non-Windows platforms --- CHANGELOG.md | 4 ++++ main.py | 6 ++++++ requirements.txt | 1 + 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a80e19..df1e1ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # YYYY-MM-DD +## 2022-05-10 + +- Add `uvloop` for non-Windows platforms to improve performance. + ## 2022-04-27 - Add more sources. diff --git a/main.py b/main.py index 6eb98d8..cb8fa91 100755 --- a/main.py +++ b/main.py @@ -377,4 +377,10 @@ async def main() -> None: if __name__ == "__main__": + try: + import uvloop + except ImportError: + pass + else: + uvloop.install() asyncio.run(main()) diff --git a/requirements.txt b/requirements.txt index 916ac85..7a89920 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ aiodns>=3.0.0,<4.0.0 aiohttp-socks>=0.7.0,<0.8.0 aiohttp>=3.8.0,<4.0.0 rich>=12.0.0,<13.0.0 +uvloop>=0.16.0,<0.17.0; sys_platform != 'win32' and sys_platform != 'cygwin' and sys_platform != 'cli'