[V3] use uvloop if available #1935
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!1935
Loading…
Reference in a new issue
No description provided.
Delete branch "uvloop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Description of the changes
uvloop is a significantly faster event loop, and we should be able to just use it where available. Being a drop in replacement, simply checking availability, and using it if is available seems safe.
Note:
I've been using this particular modification on my own bots without issue prior to making this PR
Checks are failing on docs here for something not modified by this PR
https://travis-ci.org/Cog-Creators/Red-DiscordBot/jobs/403994298#L771
I recommend only doing this automatically when the cython interpreter is detected, since uvloop is slow and sometimes problematic on pypy. Granted, pypy hasn't caught up with 3.6 yet, but it's only a matter of time.
Red doesn't run on pypy as you've already pointed out due to compatibility issues. I also don't feel this is a needed step as this will only work if the uvloop package is installed. If someone is specifically opting for pypy despite our docs making no mention of it, I generally assume they also have enough knowledge to not install uvloop on it, and uvloop is not being provided in any extras.
If even with this consideration, you still think this is an issue, I can add the check, but I'd prefer not to. There have been discussions of uvloop being a CFFI extension instead of C specifically for cases like pypy (while retaining the C one for CPython if it were faster) over at magicstack's issue tracker. While nothing has come of this yet, it would become one more thing for the development team to continue tracking to see if the check should be modified.
True. I've subbed the issue in question, but I'm still leaning towards putting in the check. My reasoning is that, because pypy shares the site package directories with cpython (on my system's build, anyway), there would be no way to exclude uvloop from being picked up if/when pypy 3.6 is released. It's better to err on the side of vanilla speed than to risk a potential slowdown--at least, until a CFFI implementation is released.
Fair enough. I'll alter the PR to include this.