Dramatically optimise inserting many items in wxGenericListCtrl.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 22 Dec 2011 14:47:54 +0000 (14:47 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 22 Dec 2011 14:47:54 +0000 (14:47 +0000)
commitb25278d885906c601a53fe4ddb246da2f68f66f9
treedd7ed34146ca6e10bfc5666ed8260030fb96df9a
parent4ffdb64018ac4e4d76c57914d02f8547bf445683
Dramatically optimise inserting many items in wxGenericListCtrl.

During each item insertion SetItem() was called and this resulted in a call to
GetItemRect() which, in turn, re-laid out all items in the control meaning
that the relatively expensive wxListMainWindow::RecalculatePositions() was
called N times when inserting N items.

Reduce this to just a single call by not refreshing the item in SetItem() if
everything is going to be redrawn soon anyhow.

This decreases the time needed to insert a couple of thousands of items in
icon view from several minutes to less than a second.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70087 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
src/generic/listctrl.cpp