[V3] use uvloop if available #1935

Merged
mikeshardmind merged 3 commits from uvloop into V3/develop 2018-07-25 05:55:55 +02:00
mikeshardmind commented 2018-07-14 23:15:37 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

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

### Type - [ ] Bugfix - [X] Enhancement - [X] New feature ### 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
tekulvw (Migrated from github.com) reviewed 2018-07-14 23:15:37 +02:00
mikeshardmind commented 2018-07-15 02:16:23 +02:00 (Migrated from github.com)

Checks are failing on docs here for something not modified by this PR

https://travis-ci.org/Cog-Creators/Red-DiscordBot/jobs/403994298#L771

Warning, treated as error:
/home/travis/build/Cog-Creators/Red-DiscordBot/docs/install_windows.rst.rst:20:broken link: https://java.com/en/download/manual.jsp (403 Client Error: Forbidden for url: https://java.com/en/download/manual.jsp)
Checks are failing on docs here for something not modified by this PR https://travis-ci.org/Cog-Creators/Red-DiscordBot/jobs/403994298#L771 ``` Warning, treated as error: /home/travis/build/Cog-Creators/Red-DiscordBot/docs/install_windows.rst.rst:20:broken link: https://java.com/en/download/manual.jsp (403 Client Error: Forbidden for url: https://java.com/en/download/manual.jsp) ```
calebj commented 2018-07-24 16:11:45 +02:00 (Migrated from github.com)

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.

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.
mikeshardmind commented 2018-07-24 19:23:34 +02:00 (Migrated from github.com)

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.

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.
calebj commented 2018-07-24 19:47:48 +02:00 (Migrated from github.com)

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.

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.
mikeshardmind commented 2018-07-24 19:50:59 +02:00 (Migrated from github.com)

Fair enough. I'll alter the PR to include this.

Fair enough. I'll alter the PR to include this.
Kowlin (Migrated from github.com) approved these changes 2018-07-25 05:54:16 +02:00
Sign in to join this conversation.
No reviewers
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
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!1935
No description provided.