[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    plan for lightweight DOM implementation
From:       Ariya Hidayat <ariya () kde ! org>
Date:       2005-10-30 15:50:10
Message-ID: ba035dd10510300750w50e47a51v54221b638573e876 () mail ! gmail ! com
[Download RAW message or body]

I'd like to give a try to implement alternative DOM implementation
which does not consume as much memory as typical QDom classes. My goal
is to have counterparts to important QDom stuff (like QDomDocument,
QDomNode, QDomElement) and retain the API so that current document
loading code can only be slightly modified. This is in constrast e.g.
if we go full the SAX-way and need to rewrite almost everyting.

The idea is as follows. Each node does not necessarily load the
attributes and its children at once, but rather only on-demand. Upon
loading the main document, only information about the first level
nodes/elements (which are children of the document) are loaded. For
each node, the positions in the content corresponding the node data
are saved. When this node is accessed, then it will "rewind" again the
content to the appropriate position, reparse the data, and again
capture only its direct children nodes.

Node can also have unload() method which explicitly purged its data
from memory. This is useful when the program knows it will not use the
node anymore. Example: when KSpread starts to parse the second sheet,
the first <table> element is not useful and can be thrown away.

I expect a performance degradation since parsing needs to be performed
many times. However, I estimate that memory requirement will be much
less. My guess is that this is worth doing it.

So I'm starting to work on this, and comments are warmly appreciated.



--
Ariya Hidayat, http://ariya.blogspot.com
http://www.google.com/search?q=ariya+hidayat&btnI
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic