From 1cec4359df0a0f705b1a13475b5971aeb721956e Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Mon, 7 Nov 2016 13:17:19 +0300 Subject: [PATCH] Cache extract_tags result for StyleChooser --- src/mapcss/StyleChooser.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mapcss/StyleChooser.py b/src/mapcss/StyleChooser.py index 84f2253..c7c620e 100644 --- a/src/mapcss/StyleChooser.py +++ b/src/mapcss/StyleChooser.py @@ -87,8 +87,11 @@ class StyleChooser: self.selzooms = None self.compatible_types = set() self.has_evals = False + self.cached_tags = None def extract_tags(self): + if self.cached_tags is not None: + return self.cached_tags a = set() for r in self.ruleChains: a.update(r.extract_tags()) @@ -104,6 +107,7 @@ class StyleChooser: if "*" in a or len(a) == 0: a.clear() a.add("*") + self.cached_tags = a return a def get_runtime_conditions(self, ftype, tags, zoom):