This is an automated email from the ASF dual-hosted git repository.
scantor pushed a commit to branch xerces-3.2
in repository https://gitbox.apache.org/repos/asf/xerces-c.git
The following commit(s) were added to refs/heads/xerces-3.2 by this push:
new decafd46e DFAContentModel::checkUniqueParticleAttribution (): speed
enhancement
decafd46e is described below
commit decafd46e1473e976566008a6b689e58bcb44285
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 a6187ca59..05f2dcd3f 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]