Mootree tree.enable() is slow

8 views
Skip to first unread message

Adriaan

unread,
Jan 7, 2009, 6:35:49 AM1/7/09
to mootree
Hi,

When a mootree is loaded with a lot of nodes (a thousand or more) it
is extremely slow.

Currently tree.enable() takes more than 11 seconds to run.

The structure I'm using the class for will eventually have probably
around 10 000 nodes, and I will need to reduce loading time to a
couple of seconds at most.

Are there any optimizations that can be implimented?

Thanks for any help
Adriaan

Rasmus Schultz

unread,
Jan 7, 2009, 9:26:01 AM1/7/09
to moo...@googlegroups.com
I've done all the optimizations I could think of - to the best of my knowledge, there are no simple optimizations that would speed this up. Unfortunately, browsers are not fast when they have to render elements in these amounts.

If possible, try using dynamic loading - loading fewer notes at a time can speed things up. Making the user pile through 10000 nodes sounds like bad UI design anyhow.

If dynamic loading is not an option - if, for example, your nodes are not clustered in sufficiently small collections of leafs to make dynamic loading worthwhile, maybe you should consider a combination of a tree, and a paginated list view of some sort, for displaying the end nodes, so that the tree is only populated with folders.

If none of these options work for you, I'm afraid there is no simple answer.

In theory, you could write a tree control that could handle 1.000.000 nodes, if necessary, but mooTree was not designed for this type of application - it was designed to be small and lightweight. To write a tree that can handle nodes in great numbers, you would have to write it from scratch, as the trees would need to be segmented somehow - rendering (and removal of rendered nodes) would need to happen on the fly, when the user scrolls... I'm afraid these are not features you could simply add to mooTree - you would have to design this from the ground up. You could reuse parts of mooTree, but I don't think you could simply extend it with these features - there would not be much left of the original code.

Alternatively, try this this tree control:


It's a larger codebase, and does not seem to support loading on the fly, but does seem to load 1500 nodes pretty fast - it sounds like your tree data alone will result in quite a footprint, so if this is a back-end application, you might consider just loading the whole thing all at once, if that's faster...
Reply all
Reply to author
Forward
0 new messages