diff options
author | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-05-15 08:03:57 +0200 |
---|---|---|
committer | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-10-08 20:54:53 +0200 |
commit | d736c075cd697fe38e0d7836d127c8bd7d884ada (patch) | |
tree | 06187d0a4e27bb2c067d77e6626cd014c15fe3c6 /giscanner/annotationparser.py | |
parent | 2daced86c79a888cdedddc84ed7dee736483bc05 (diff) | |
download | gobject-introspection-d736c075cd697fe38e0d7836d127c8bd7d884ada.tar.gz |
giscanner: define __slots__ on some classes
For example, when creating Gtk-3.0.gir, thousands of instances
of these classes get created. This makes us waste less space
for these instances by not having their __dict__ being created.
Diffstat (limited to 'giscanner/annotationparser.py')
-rw-r--r-- | giscanner/annotationparser.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py index 33137c1e..b8e86e90 100644 --- a/giscanner/annotationparser.py +++ b/giscanner/annotationparser.py @@ -449,6 +449,8 @@ MULTILINE_ANNOTATION_CONTINUATION_RE = re.compile( class DocBlock(object): + __slots__ = ('name', 'annotations', 'value', 'tags', 'description', 'params', 'position') + def __init__(self, name): self.name = name self.annotations = DocAnnotations() @@ -508,6 +510,8 @@ class DocBlock(object): class DocTag(object): + __slots__ = ('block', 'name', 'annotations', 'description', 'value', 'position') + def __init__(self, block, name): self.block = block self.name = name @@ -685,6 +689,9 @@ class DocTag(object): class DocAnnotations(object): + + __slots__ = ('values', 'position') + def __init__(self): self.values = [] self.position = None @@ -724,6 +731,8 @@ class DocAnnotations(object): class DocOption(object): + __slots__ = ('tag', '_array', '_dict') + def __init__(self, tag, option): self.tag = tag self._array = [] |