mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 12:12:54 +01:00
Seen, ChannelUserDictionary: Internalize channel names.
They are not many of them, but they are used a lot so they take up a surprising amount of memory.
This commit is contained in:
parent
08f4c781cb
commit
2682e4cb48
@ -65,6 +65,7 @@ class SeenDB(plugins.ChannelUserDB):
|
||||
|
||||
def update(self, channel, nickOrId, saying):
|
||||
seen = time.time()
|
||||
channel = sys.intern(channel)
|
||||
self[channel, nickOrId] = (seen, saying)
|
||||
self[channel, '<last>'] = (seen, saying)
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
import gc
|
||||
import os
|
||||
import csv
|
||||
import sys
|
||||
import time
|
||||
import codecs
|
||||
import string
|
||||
@ -188,6 +189,7 @@ class ChannelUserDictionary(collections.abc.MutableMapping):
|
||||
|
||||
def __setitem__(self, key, v):
|
||||
(channel, id) = key
|
||||
channel = sys.intern(channel)
|
||||
if channel not in self.channels:
|
||||
self.channels[channel] = self.IdDict()
|
||||
self.channels[channel][id] = v
|
||||
@ -242,6 +244,7 @@ class ChannelUserDB(ChannelUserDictionary):
|
||||
except ValueError:
|
||||
# We'll skip over this so, say, nicks can be kept here.
|
||||
pass
|
||||
channel = sys.intern(channel)
|
||||
v = self.deserialize(channel, id, t)
|
||||
self[channel, id] = v
|
||||
except Exception as e:
|
||||
|
Loading…
Reference in New Issue
Block a user