Changeset - 3aee1efdc1ad
[Not reviewed]
0 1 0
Brett Smith - 4 years ago 2020-03-31 19:00:15
brettcsmith@brettcsmith.org
data: Define __slots__ for core classes.

Because these are the classes that get instantiated many times while
iterating transactions, the performance benefit of defining __slots__
is worth the development overhead.
1 file changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/data.py
Show inline comments
...
 
@@ -64,2 +64,4 @@ class Account(str):
 
    """
 
    __slots__ = ()
 

	
 
    SEP = bc_account.sep
...
 
@@ -117,2 +119,3 @@ class Metadata(MutableMapping[MetaKey, MetaValue]):
 
    """
 
    __slots__ = ('meta',)
 

	
...
 
@@ -167,2 +170,3 @@ class PostingMeta(Metadata):
 
    """
 
    __slots__ = ('txn', 'index', 'post')
 

	
...
 
@@ -209,2 +213,3 @@ class Posting(BasePosting):
 
    """
 
    __slots__ = ()
 

	
0 comments (0 inline, 0 general)