[varStore] remove unused _Encoding methods

This commit is contained in:
Cosimo Lupo 2025-02-06 19:11:30 +00:00
parent 548ffda37b
commit d4565155b8

View File

@ -412,25 +412,6 @@ class _Encoding(object):
def extend(self, lst): def extend(self, lst):
self.items.update(lst) self.items.update(lst)
def get_room(self):
"""Maximum number of bytes that can be added to characteristic
while still being beneficial to merge it into another one."""
count = len(self.items)
return max(0, (self.overhead - 1) // count - self.width)
room = property(get_room)
def get_gain(self):
"""Maximum possible byte gain from merging this into another
characteristic."""
count = len(self.items)
return max(0, self.overhead - count)
gain = property(get_gain)
def gain_sort_key(self):
return self.gain, self.chars
def width_sort_key(self): def width_sort_key(self):
return self.width, self.chars return self.width, self.chars
@ -534,13 +515,9 @@ def VarStore_optimize(self, use_NO_VARIATION_INDEX=True, quantization=1):
# of the old encoding is completely eliminated. However, each row # of the old encoding is completely eliminated. However, each row
# now would require more bytes to encode, to the tune of one byte # now would require more bytes to encode, to the tune of one byte
# per characteristic bit that is active in the new encoding but not # per characteristic bit that is active in the new encoding but not
# in the old one. The number of bits that can be added to an encoding # in the old one.
# while still beneficial to merge it into another encoding is called
# the "room" for that encoding.
# #
# The "gain" of an encodings is the maximum number of bytes we can # The "gain" of merging two encodings is how many bytes we save by doing so.
# save by merging it into another encoding. The "gain" of merging
# two encodings is how many bytes we save by doing so.
# #
# High-level algorithm: # High-level algorithm:
# #