[commands] Optimise GroupMixin.get_command for the no space case.

Comes at a 30ns slowdown for the space case, however.
This commit is contained in:
Rapptz 2019-03-16 09:27:59 -04:00
parent 8466250bcc
commit 3326adf63b

View File

@ -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):