mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-08 10:53:10 +00:00
Use a dict instead of getattr for parsing events.
Probably not a significant difference but might as well use it here. The basic idea is to cache the getattr calls instead of repeatedly doing it (since they're around 105ns on my machine). The dictionary lookup is about 41ns on my machine. The next step in speeding up library code some more should be in the parser bodies themselves but that's a problem to tackle another day.
This commit is contained in:
@ -221,6 +221,7 @@ class AutoShardedClient(Client):
|
||||
|
||||
ws.token = self.http.token
|
||||
ws._connection = self._connection
|
||||
ws._discord_parsers = self._connection.parsers
|
||||
ws._dispatch = self.dispatch
|
||||
ws.gateway = gateway
|
||||
ws.shard_id = shard_id
|
||||
|
Reference in New Issue
Block a user