[fpc-devel] Want to remove AVL_Tree from DOM
Michael Van Canneyt
michael at freepascal.org
Sat Oct 24 09:34:55 CEST 2009
On Sat, 24 Oct 2009, Sergei Gorelkin wrote:
> Hello,
>
> I want to remove the avl_tree-related stuff from DOM unit. The reasons are:
>
> 1) It is targeted to optimize one particular type of documents, "configs",
> that require all node names within a single parent to be unique (strictly
> speaking, this isn't xml, it is more like ini-files or Windows registry).
>
> For all other xml documents (which have repeating names) it simply doesn't
> work.
>
> 2) It is a severe performance and memory bottleneck. This maybe wasn't too
> noticeable
> in the past, but things had improved over time. Here are some numbers:
Since avl_tree was built to improve performance, this alone is reason enough
to replace it with something more performant.
> Given the above, I see no sense in further keeping this feature. However, the
> configs likely
> need some sort of optimization anyway. I see the following options:
>
> 1) Since all names in DOM document are now stored in a hashtable, it is easy
> to modify
> FindNode() so it compares pointers rather than strings.
>
> 2) The new xmlconf unit has the OpenKey/CloseKey methods which improve
> performance by limiting
> the search range to a specific element. Utilizing this feature, however,
> need modifications to
> the user code so it actually calls OpenKey/CloseKey (note that is works
> perfectly without the
> modifications, it's only the matter of performance).
>
> 3) It is possible to create even faster xmlconfig class, consisting of
> TXMLDocument + THashTable,
> offering O(1) access to any element. The problem is that it is somewhat
> mutually exclusive
> to the previous solution (OpenKey/CloseKey).
>
> 4) Finally, the xpath, being sufficiently mature, can supersede it all and
> provide
> a much more powerful solution.
In the long run, I think XPath is the way to go, it's a standard, after all.
Michael.
More information about the fpc-devel
mailing list