Performance Patches by David Bertoni.
Details: (see xerces-c-dev mailing Jan 14) XMLRecognizer.cpp: the internal encoding string XMLUni::fgXMLChEncodingString was going through this function numerous times. As a result, the top hot-spot for the parse was _wcsicmp(). The real problem is that the Microsofts wide string functions are unbelievably slow. For things like encodings, it might be better to use a special comparison function that only considers a-z and A-Z as characters with case. This works since the character set for encodings is limit to printable ASCII characters. XMLScanner2.cpp: This also has some case-sensitive vs. insensitive compares. They are also much faster. The other tweak is to only make a copy of an attribute string if it needs to be split. And then, the strategy is to try to use a stack-based buffer, rather than a dynamically-allocated one. SAX2XMLReaderImpl.cpp: Again, more case-sensitive vs. insensitive comparisons. KVStringPair.cpp & hpp: By storing the size of the allocation, the storage can likely be re-used many times, cutting down on dynamic memory allocations. XMLString.hpp: a more efficient implementation of stringLen(). DTDValidator.cpp: another case of using a stack-based buffer when possible These patches made a big difference in parse time in some of our test files, especially the ones are very attribute-heavy. git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@172497 13f79535-47bb-0310-9956-ffa450edef68
Showing
- src/framework/XMLRecognizer.cpp 6 additions, 1 deletionsrc/framework/XMLRecognizer.cpp
- src/internal/XMLScanner2.cpp 27 additions, 11 deletionssrc/internal/XMLScanner2.cpp
- src/parsers/SAX2XMLReaderImpl.cpp 31 additions, 2 deletionssrc/parsers/SAX2XMLReaderImpl.cpp
- src/util/KVStringPair.cpp 57 additions, 10 deletionssrc/util/KVStringPair.cpp
- src/util/KVStringPair.hpp 38 additions, 0 deletionssrc/util/KVStringPair.hpp
- src/util/XMLString.hpp 40 additions, 6 deletionssrc/util/XMLString.hpp
- src/validators/DTD/DTDValidator.cpp 19 additions, 2 deletionssrc/validators/DTD/DTDValidator.cpp
Loading
Please register or sign in to comment