From 74505ffdada84b796fb5f6adc42878f330fc9460 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 22 Apr 2020 12:07:07 -0700 Subject: [ci skip] Speedup xml validation called by bin/docs-update-generated.py by caching parsed docbook schema. Yields approx 60x speedup --- bin/SConsDoc.py | 10 +++++++--- src/CHANGES.txt | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/SConsDoc.py b/bin/SConsDoc.py index e211b3c..960a0c9 100644 --- a/bin/SConsDoc.py +++ b/bin/SConsDoc.py @@ -345,10 +345,14 @@ if not has_libxml2: t = etree.Element(root, nsmap=NSMAP) return self.decorateWithHeader(t) + # singleton to cache parsed xmlschema.. + xmlschema = None + @staticmethod def validateXml(fpath, xmlschema_context): - # Use lxml - xmlschema = etree.XMLSchema(xmlschema_context) + + if TreeFactory.xmlschema is None: + TreeFactory.xmlschema = etree.XMLSchema(xmlschema_context) try: doc = etree.parse(fpath) except Exception as e: @@ -357,7 +361,7 @@ if not has_libxml2: return False doc.xinclude() try: - xmlschema.assertValid(doc) + TreeFactory.xmlschema.assertValid(doc) except Exception as e: print("ERROR: %s fails to validate:" % fpath) print(e) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6b7c014..c1bf24c 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -34,6 +34,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER package can create scripts which use the correct version of Python. - Resolve Issue #3248 - Removing '-Wl,-Bsymbolic' from SHLIBVERSIONFLAGS NOTE: If your build depends on the above you must now add to your SHLIBVERSIONFLAGS + - Speedup bin/docs-update-generated by caching parsed docbook schema. (60x speedup) From Jeremy Elson: -- cgit v0.12