Project

General

Profile

« Previous | Next » 

Revision 429

Added by Matt Jones over 20 years ago

Fixed document reading bug (bugzilla bug #111) so that reading documents
is no longer a power function of the number of nodes in the document
(which used to be the case). Now, reading a document occurs entirely
within DocumentImpl, by making a single SQL call to get the document data,
and then using the NodeComparator class to return a TreeSet of the nodes
sorted in a depth-first traversal order. This TreeSet is then processed
by the new DocumentImpl.toXml() methods, which formats and outputs a text
representation of the document to the Writer that is passed in. The
DocumentImpl.toString() method has been re-written to utilize
DocumentImpl.toXml() as well.

The old algorithm for searching (that utilized the ElementNode, textNode,
CommentNode, and PINode classes) is still implemented for comparison purposes,
and can be accessed by calling the readUsingSlowAlgorithm() method. A
timing option has been added to DocumentImpl.main() so that the methods can be
compared (see the -t and -old options). Although the difference in read
time is only a fraction of a second for small documents (< 1K), the new
method of reading is 72 times faster than the old method for a 34K
document (1.9 seconds versus 144 seconds). This difference continues to grow
as the node count increases.
BugID: 111

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences