summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2013-05-15 08:03:57 +0200
committerDieter Verfaillie <dieterv@optionexplicit.be>2013-10-08 20:54:53 +0200
commitd736c075cd697fe38e0d7836d127c8bd7d884ada (patch)
tree06187d0a4e27bb2c067d77e6626cd014c15fe3c6 /giscanner
parent2daced86c79a888cdedddc84ed7dee736483bc05 (diff)
downloadgobject-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')
-rw-r--r--giscanner/annotationparser.py9
-rw-r--r--giscanner/message.py3
2 files changed, 12 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 = []
diff --git a/giscanner/message.py b/giscanner/message.py
index 3a330afe..fc6100e0 100644
--- a/giscanner/message.py
+++ b/giscanner/message.py
@@ -34,6 +34,9 @@ class Position(object):
"""Represents a position in the source file which we
want to inform about.
"""
+
+ __slots__ = ('filename', 'line', 'column')
+
def __init__(self, filename=None, line=None, column=None):
self.filename = filename
self.line = line