Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1745
Question, and need sample code for 'walking the Tree'
posted

Does anyone have sample code for either

a) reading all nodes in the tree (so I can write the data to a file)
b) reading a file of (very basic) node data and recreating the tree.

I know there are serialization functions but when the tree contains a lot of data the output from these can be HUGE.

My test app (which saved metadata for a single database) wrote out 5MB in Binary and about twice that in XML.

My users can easily have 10 times that many and I don't think 50 - 100MB is going to go down too well.

The problem is that you serialize everything.
My own requirements are to simply serialize the Key, Text, and Image.
(maybe the level also if that makes it easier to rebuild the Tree.)

My other concern is that if I manually save/load using the public methods (AddNode() etc.) the performance may not be so good. Does anyone have any data on performance of the serialization methods vs rebuilding the tree manually?

Thanks
Mike

 

 

  • 1745
    Verified Answer
    Offline posted

    I found the code for walking the tree while searching the Help file to answer another question.

    My initial tests show that compared to Load/SaveAsBinary my own functions

       Create a file that is 6 times smaller
       Save the data 9 times faster
       Load the data more than 3 times slower (no optimizations done yet so I hope to improve that)

    Note that I had forgotten the 'Tag' property when I listed the fields I needed to save. (This increased the size by 40%)

    It seems odd that I can save the data so much faster, but take much longer to load it.
    The problem comes from the fact that I need to 'Find' the parent node before I can add each child I think.

    Mike