perf: specify slots on FIFO queue

This commit is contained in:
Ankush Menat 2021-12-19 19:08:09 +05:30 committed by Ankush Menat
parent aa0e163b1f
commit 745caf911a

View File

@ -20,6 +20,10 @@ class FifoValuation:
ref: https://en.wikipedia.org/wiki/FIFO_and_LIFO_accounting
"""
# specifying the attributes to save resources
# ref: https://docs.python.org/3/reference/datamodel.html#slots
__slots__ = ["queue",]
def __init__(self, state: Optional[List[FifoBin]]):
self.queue: List[FifoBin] = state if state is not None else []