On 25 Dec 2011, at 02:24, Greg Ercolano wrote: > On 12/23/11 11:06, Greg Ercolano wrote: >> On 12/22/11 12:27, David FLEURY wrote: >>> You are right, I will see for a Tree Item solution, to avoid regression >>> somewhere else. >>> I do not know well enough fltk to have any opinion on this subject. >>> Just try to make my tests work for my own configuration. >> >> I was noodling with creating an Fl_Tree of 65536 in size, >> and I can definitely see some room for optimization; >> adding elements is slow, and scrolling elements is slow. >> >> I'll see if I can take a stab at optimizing that so that >> adding elements is quicker, and also changing the draw() >> routine so that it only draws items that are within the window. > > OK, just checked in r9216 which should optimize Fl_Tree > quite a bit. David, please give it a try: > > Adding items in a large linear list should be quite a bit > faster now; the slowness was due to repeat calls to find_child() > unnecessarily to figure out the insert point, which was causing > the exponential slowness. > > Drawing items should be much faster and should not suffer > the wraparound issues described, because now draw() only draws > items whose y() positions are within the Fl_Tree xywh area. > > I tested with the following code that creates 100k items > which is entirely unusable in r9215 and lower, but should be > quite normal in r9216 and up. > > There is still a practical limit on the number of items that > can be in the tree; draw() will still /consider/ (ie. do calculations > on) items that are not hidden (ie. open() and visible()), but at least > it won't try to /draw/ items unless they're inside the window. >
Hi Greg - Just tested the new version, it works great! There's one little bug though: the "connections" between the items are sometimes missing. To reproduce: launch test/tree set "Line style" to "Dotted" or "Solid" open the "Ascending" and "Descending" items scroll down Look how the lines connecting ROOT, Bbb, etc. disappear/reappear when you scroll up and down. Christophe > -------------------------------------------------------------------- > > #include <FL/Fl.H> > #include <FL/Fl_Double_Window.H> > #include <FL/Fl_Tree.H> > int main( int argc, char **argv) { > Fl_Double_Window *w = new Fl_Double_Window(900,300); > Fl_Tree *b = new Fl_Tree(10,10,w->w()-20,w->h()-20); > char s[80]; > for ( int t=0; t<60000; t++ ) > { > sprintf(s, "Entry #%06d", t); > b->add(s); > if ( t % 50 == 0 ) printf("Working on %d\n", t); > } > w->resizable(b); > w->end(); > w->show(); > return(Fl::run()); > } > -------------------------------------------------------------------- > _______________________________________________ > fltk mailing list > fltk@easysw.com > http://lists.easysw.com/mailman/listinfo/fltk -- Prof. Christophe Geuzaine University of Liege, Electrical Engineering and Computer Science http://www.montefiore.ulg.ac.be/~geuzaine _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk