This is an automated email from the ASF dual-hosted git repository.
rleigh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/xerces-c.git
The following commit(s) were added to refs/heads/master by this push:
new 02cec95 DFAContentModel::checkUniqueParticleAttribution (): speed
enhancement
new c0b90c2 Merge pull request #37 from
rouault/faster_checkUniqueParticleAttribution
02cec95 is described below
commit 02cec9524882815db078fa5fb7486762928a4d3d
Author: Even Rouault <[email protected]>
AuthorDate: Mon Sep 20 11:59:45 2021 +0200
DFAContentModel::checkUniqueParticleAttribution (): speed enhancement
The complexity of this method is roughly O(n^3). Fuzzers can generate
schemas with n = several thousands. The test fTransTable[i][j] ==
XMLContentModel::gInvalidTrans
is independant of the k loop, and can thus being moved at a upper level
to improve runtime.
---
src/xercesc/validators/common/DFAContentModel.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/xercesc/validators/common/DFAContentModel.cpp
b/src/xercesc/validators/common/DFAContentModel.cpp
index 2f590fe..5030565 100644
--- a/src/xercesc/validators/common/DFAContentModel.cpp
+++ b/src/xercesc/validators/common/DFAContentModel.cpp
@@ -1642,9 +1642,10 @@ void DFAContentModel::checkUniqueParticleAttribution
(SchemaGrammar* const pG
// for each state, check whether it has overlap transitions
for (i = 0; i < fTransTableSize; i++) {
for (j = 0; j < fElemMapSize; j++) {
+ if (fTransTable[i][j] == XMLContentModel::gInvalidTrans)
+ continue;
for (k = j+1; k < fElemMapSize; k++) {
- if (fTransTable[i][j] != XMLContentModel::gInvalidTrans &&
- fTransTable[i][k] != XMLContentModel::gInvalidTrans &&
+ if (fTransTable[i][k] != XMLContentModel::gInvalidTrans &&
conflictTable[j][k] == 0) {
// If this is text in a Schema mixed content model, skip
it.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]