aboutsummaryrefslogtreecommitdiff
path: root/discord
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-07-05 21:41:32 -0400
committerRapptz <[email protected]>2021-07-07 20:19:17 -0400
commit03cd6ff433d42c1e1b91800cdc93dd6aa108e99d (patch)
treeec36bca60d89ab3a3cc41b3e3850f4a79c507a71 /discord
parentChange _Overwrite to get dict entries rather than mutate (diff)
downloaddiscord.py-03cd6ff433d42c1e1b91800cdc93dd6aa108e99d.tar.xz
discord.py-03cd6ff433d42c1e1b91800cdc93dd6aa108e99d.zip
Remove calls to gc.collect in ConnectionState
For some bots this was actually a performance bottleneck, might as well remove it if it causes bad performance
Diffstat (limited to 'discord')
-rw-r--r--discord/state.py18
1 files changed, 0 insertions, 18 deletions
diff --git a/discord/state.py b/discord/state.py
index a04ce80f..f51c5037 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -32,7 +32,6 @@ from typing import Dict, Optional
import weakref
import warnings
import inspect
-import gc
import os
@@ -215,11 +214,6 @@ class ConnectionState:
self._private_channels_by_user = {}
self._messages = self.max_messages and deque(maxlen=self.max_messages)
- # In cases of large deallocations the GC should be called explicitly
- # To free the memory more immediately, especially true when it comes
- # to reconnect loops which cause mass allocations and deallocations.
- gc.collect()
-
def process_chunk_requests(self, guild_id, nonce, members, complete):
removed = []
for key, request in self._chunk_requests.items():
@@ -332,10 +326,6 @@ class ConnectionState:
del guild
- # Much like clear(), if we have a massive deallocation
- # then it's better to explicitly call the GC
- gc.collect()
-
@property
def emojis(self):
return list(self._emojis.values())
@@ -1396,14 +1386,6 @@ class AutoShardedConnectionState(ConnectionState):
self.dispatch('connect')
self.dispatch('shard_connect', data['__shard_id__'])
- # Much like clear(), if we have a massive deallocation
- # then it's better to explicitly call the GC
- # Note that in the original ready parsing code this was done
- # implicitly via clear() but in the auto sharded client clearing
- # the cache would have the consequence of clearing data on other
- # shards as well.
- gc.collect()
-
if self._ready_task is None:
self._ready_task = asyncio.create_task(self._delay_ready())