This is an automated email from the ASF dual-hosted git repository.
slawrence pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git
The following commit(s) were added to refs/heads/master by this push:
new e23e162 Remove extraneous XML loads for repeating include/imports
e23e162 is described below
commit e23e162eef34baf35b8af4e3b2a200d4468626dd
Author: Steve Lawrence <[email protected]>
AuthorDate: Wed Feb 27 13:58:43 2019 -0500
Remove extraneous XML loads for repeating include/imports
We already have logic to detect when the same file has been
included/imported so that we can prevent circular imports. However, we
defined requiredEvaluations on the iiSchemaFile, which forces a load and
parse of the schema regardless if it had already been loaded or not. For
large schemas with lots of imports of the same thing (e.g. multiple
schema files importing a common schema), this could result in a lot of
duplicated effort.
Instead, define the requiredEvaluations on the iiSchemaFileMaybe, which
will only load the schema if it hasn't been seen.
On some large schemas with lots of repeating imports, this saw a
reduction in schema compile time of about 15%.
DAFFODIL-2071
---
.../src/main/scala/org/apache/daffodil/dsom/IIBase.scala | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/IIBase.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/IIBase.scala
index ddd8681..5a06bca 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/IIBase.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/IIBase.scala
@@ -132,9 +132,16 @@ abstract class IIBase( final override val xml: Node,
xsdArg: XMLSchemaDocument,
* An import/include requires only that we can access the
* schema file, recursively any of its includes/imports,
* and that all the resulting are validated by the validating loader.
+ *
+ * It is important to point out that this intentionally references
+ * iiSchemaFileMaybe rather than iiSchemaFile because the former only loads a
+ * schema if it hasn't been seen before. If we instead required the
+ * evaluation of iiSchemaFile, it would force loading of schemas that have
+ * already been seen and result in duplicate effort and slower schema
+ * compilation.
*/
- requiredEvaluations(iiSchemaFile)
- requiredEvaluations(iiSchemaFile.iiXMLSchemaDocument)
+ requiredEvaluations(iiSchemaFileMaybe)
+ requiredEvaluations(iiSchemaFileMaybe.map(_.iiXMLSchemaDocument))
protected final def notSeenThisBefore = LV('notSeenThisBefore) {
val mp = mapPair