On 02/06/2010 2:49 AM, Ralph Versteegen wrote:
On 2 June 2010 10:33,<[email protected]> wrote:
pkmnfrk
2010-06-01 15:33:51 -0700 (Tue, 01 Jun 2010)
1806
Finally added support for RELOAD delay loading: (see below for details)
- Added new utility reloadtime.bas, which times exactly how long it takes to
load any random RELOAD document.
- reload2xml now passes optNoDelay, since it does not benefit from delay loading
- reloadTest now includes two document comparison tests: first with no delay
loading, and then again with delay loading.
- xml2reload now display memory usage (again? I don't know if I ever committed
this change), and frees the XML document before optimizing the RELOAD tree (I
meant to commit this two days ago)
Delay Loading: This means that nodes will only be loaded from disk as they are
accessed. Depending on what the tree is being used for this can be a huge time
saver. The ideal use-case for this feature would be the hypothetical Textbox
lump, whereby only the textboxes that are referenced are actually loaded. This
would speed up loading the document initially, with the tradeoff of spreading
out the document load to later.
Basically, it works like this:
1. When the document is loaded, the root node (including data) is loaded, but
its children are not.
2. If its children are requested (eg, by calling GetFirstChild or AddChild or
something), it will load all its kids (but not their children), and the
requested operation can take place.
3. Repeat for each of those children that are requested.
While this takes place, the document holds on to the file handle (so that the
document cannot be modified or removed while it still refers to it), and
releases it when the document is freed.
The old behaviour of loading everything at the beginning can be restored by
passing optNoDelay to RELOAD.LoadDocument.
I've tested everything pretty thoroughly, but as always, if you find a way to
break it (tmc>:@), let me know.
---
U wip/makereload.bat
U wip/makereload.sh
U wip/reload.bas
U wip/reload.bi
U wip/reload2xml.bas
U wip/reloadtest.bas
A wip/reloadtime.bas
U wip/xml2reload.bas
This looks great! Not yet subjected to stress testing ;)
Two things: you forgot to update AddChild (funny, you actually gave it
as an example :P),
Hmm, you are correct. I will work on this tomorrow
and there's no point marking a node without children as delayed-load.
True. Strictly speaking, it doesn't matter at all, but it should be done
for completeness.
Also, now we should have function to force loading a node and all its
descendants: if you want to read a textbox, you don't want to read
from file every time you encounter a node with children.
Yes, actually I was going to do this tomorrow. I should have mentioned
that, but hey.
--
Mike
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org