summaryrefslogtreecommitdiff
path: root/giscanner/ast.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/ast.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/ast.py')
-rw-r--r--giscanner/ast.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 58540912..d307b553 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -25,7 +25,7 @@ from itertools import chain
from . import message
from .message import Position
-from .odict import odict
+from .odict import OrderedDict
from .utils import to_underscores
class Type(object):
@@ -367,7 +367,7 @@ class Namespace(object):
self.symbol_prefixes = [to_underscores(p).lower() for p in ps]
# cache upper-cased versions
self._ucase_symbol_prefixes = [p.upper() for p in self.symbol_prefixes]
- self.names = odict() # Maps from GIName -> node
+ self.names = OrderedDict() # Maps from GIName -> node
self.aliases = {} # Maps from GIName -> GIName
self.type_names = {} # Maps from GTName -> node
self.ctypes = {} # Maps from CType -> node