garrynewman / GWEN

Abandoned: GWEN - GUI Without Extravagant Nonsense.
MIT License
427 stars 102 forks source link

TreeControl extreme slow with many children (+workaround) #75

Open erwincoumans opened 11 years ago

erwincoumans commented 11 years ago

When adding 10k or 100k items in the list, the performance of TreeControl grinds to a halt. Reproduction: simply add a while loop in the UnitTest.cpp

char msg[1024]; for (int i=0; i < 10000;i++) { sprintf(msg,"Node %d",i); Gwen::UnicodeString txt =Gwen::Utility::StringToUnicode(msg); ctrl->AddNode( msg);//L"Node One" ); }

It seems the TreeControl::OnChildBoundsChanged is called many times, and causes the slowdown.

When uncommenting the "m_ScrollControl->UpdateScrollBars();" , it becomes fast, and you can have 10.000 or even 100.000 items in the TreeControl. Obviously, you have to make sure the 'UpdateScrollBars()' is still called, whenever changes happen.

Perhaps GWEN could use lazy evaluation for the UpdateScrollBars?