[Project_owners] Re: Working with big XML files: memory and persistence issues

Axel Hecht axel at pike.org
Sun Jan 30 18:09:10 EST 2005


Hi Stan,

I suggest that you create an xpcom service to hold the data stored in 
your XML file.

I don't think there is a way to find out the storage of a DOM tree. But 
it will be considerably less than what DOMI shows. That for example 
triggers all those DOM3 tearoffs, and you probably don't need alot of 
DOM slots and stuff. Guessing about the slot stuff though.

If your files are big, you should remember that children are held in an 
array structure. Thus, childNodes[n] is preferred over nextSibling while 
iterating over large counts of children.

Axel

>>> Hi all,
>>>
>>> My FF extension keeps a [potentially] big XML file loaded in memory, 
>>> which it needs to access quite often. Right now it works fine with a 
>>> ~300K file, but I'd like to handle bigger files. (~2megs, but bigger 
>>> is better)  Haven't dared to try yet...
>>>
>>> How can I keep this data quickly accessible to my extension in all 
>>> windows, without each window needing to keep it's own copy? (Right 
>>> now I always have a "designated window."  And if it gets closed then 
>>> the next window will re-load/parse the file.)
>>>
>>> On a side note, is there any way to find out how much memory a 
>>> structure is actually using? I have no idea how much overhead there 
>>> is for internal XML trees. (Looking at all those properties in the 
>>> DOM inspector, I feel there might be a lot!)
>>>
>>> Any better ideas on keeping a big store of data quickly accessible? 
>>> Anybody else shoving around big XML structures? Thanks for any tips!
>>>
>>> -stan


More information about the Project_owners mailing list