summaryrefslogtreecommitdiff
path: root/giscanner/annotationparser.py
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2013-02-14 17:41:49 +0100
committerDieter Verfaillie <dieterv@optionexplicit.be>2013-04-09 23:14:03 +0200
commit5ed56c0b62f917b448d28bf4742300fa173dbd90 (patch)
treefaf0818c611bf3103dfa855a3857c3d2a7650011 /giscanner/annotationparser.py
parent2734e9a3334db0304c07bd892a863db076c3a543 (diff)
downloadgobject-introspection-5ed56c0b62f917b448d28bf4742300fa173dbd90.tar.gz
giscanner: use SqlAlchemy's OrderedDict implementation
g-ir-scanner can be a bit on the slow side. While true we now do a bit more work parsing GTK-Doc comment blocks and more is still to come, one of the biggest hotspots besides what's going on in _giscanner.SourceScanner() comes from the OrderedDict implementations we have been using. For example, time needed to build Gtk-3.0.gir on a relatively slow machine using "python2 -m cProfile -o $prefix/bin/g-ir-scanner ...": 1) Our original DictMixin sublass: 92,79867 seconds 2) Python's collections.OrderedDict class: 88,65786 seconds 3) Larosa/Foord implementation from http://www.voidspace.org.uk/python/odict.html : 71,64323 seconds 4) SqlAlchemy's implementation: 66,12449 seconds Looks like we have a clear winner with the SqlAclchemy implementation, which comes in at around 20 seconds without profiling on the same machine. Not bad. https://bugzilla.gnome.org/show_bug.cgi?id=697620
Diffstat (limited to 'giscanner/annotationparser.py')
-rw-r--r--giscanner/annotationparser.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 23144576..f722346c 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -26,7 +26,7 @@
import re
from . import message
-from .odict import odict
+from .odict import OrderedDict
# GTK-Doc comment block parts
@@ -367,9 +367,9 @@ class DocBlock(object):
self.name = name
self.options = DocOptions()
self.value = None
- self.tags = odict()
+ self.tags = OrderedDict()
self.comment = None
- self.params = odict()
+ self.params = OrderedDict()
self.position = None
def __cmp__(self, other):
@@ -655,7 +655,7 @@ class DocOption(object):
def __init__(self, tag, option):
self.tag = tag
self._array = []
- self._dict = odict()
+ self._dict = OrderedDict()
# (annotation option1=value1 option2=value2) etc
for p in option.split(' '):
if '=' in p: