diff options
author | Johan Dahlin <johan@gnome.org> | 2010-09-20 10:35:48 -0300 |
---|---|---|
committer | Johan Dahlin <johan@gnome.org> | 2010-09-20 10:46:52 -0300 |
commit | 84aa7defdb1a3082021bd28a61803a1e140cf8ca (patch) | |
tree | 6228c57a55cee6b245d709511607f71103cf357b /giscanner/transformer.py | |
parent | 85594416e516f939cda4de4a35cee90812fe659c (diff) | |
download | gobject-introspection-84aa7defdb1a3082021bd28a61803a1e140cf8ca.tar.gz |
[scanner] Only store types in cache store
Only store types that can be referenced in the cache store
this reduces the size of the serialized Gtk-3.0.gir in the store
from 5.7M to 366k on my system.
It also reduces the time it takes to create a gir in gtksourceview
by 35% and the time to run the warnings test by more than 50%
This also disables the cache for passthrough mode since it needs
access to the whole serialized tree.
Diffstat (limited to 'giscanner/transformer.py')
-rw-r--r-- | giscanner/transformer.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/giscanner/transformer.py b/giscanner/transformer.py index be34ff5f..70addb26 100644 --- a/giscanner/transformer.py +++ b/giscanner/transformer.py @@ -54,6 +54,7 @@ class Transformer(object): self._includes = {} self._include_names = set() self._includepaths = [] + self._passthrough_mode = False def get_includes(self): return self._include_names @@ -61,6 +62,12 @@ class Transformer(object): def get_pkgconfig_packages(self): return self._pkg_config_packages + def disable_cache(self): + self._cachestore = None + + def set_passthrough_mode(self): + self._passthrough_mode = True + def _append_new_node(self, node): original = self._namespace.get(node.name) # Special case constants here; we allow duplication to sort-of @@ -169,11 +176,14 @@ None.""" sys.exit(1) def _parse_include(self, filename, uninstalled=False): - parser = self._cachestore.load(filename) + parser = None + if self._cachestore is not None: + parser = self._cachestore.load(filename) if parser is None: - parser = GIRParser() + parser = GIRParser(types_only=not self._passthrough_mode) parser.parse(filename) - self._cachestore.store(filename, parser) + if self._cachestore is not None: + self._cachestore.store(filename, parser) for include in parser.get_includes(): self.register_include(include) |