From 3326adf63b3ba46b24d314a37a8c6f1dbf6ac415 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 16 Mar 2019 09:27:59 -0400 Subject: [PATCH] [commands] Optimise GroupMixin.get_command for the no space case. Comes at a 30ns slowdown for the space case, however. --- discord/ext/commands/core.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 6b9b3c9e6..30e110dad 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -1015,6 +1015,10 @@ class GroupMixin: The command that was requested. If not found, returns ``None``. """ + # fast path, no space in name. + if ' ' not in name: + return self.all_commands.get(name) + names = name.split() obj = self.all_commands.get(names[0]) if not isinstance(obj, GroupMixin):