CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Speed of adding or deleteing items in a listctrl

    When I added a large number of items(for example, 100000) into a listctrl, it
    took more than 3 minute. And when I deleted all the items in this listctrl by
    using DeleteAllItems(), it took almost 15 minutes. I already called SetRedraw(
    FALSE) before doing these. My PC is PII 450 with 128M memory and the system is
    Win98. Does anybody know how to resolve this problem?


  2. #2
    Join Date
    May 1999
    Location
    Reading, England
    Posts
    28

    Re: Speed of adding or deleteing items in a listctrl

    Hi,

    One way of doing improving the speed if you know roughly how many items you are inserting is to use CListCtrl::SetItemCount().

    This tells the control to allocate memory for the items before you begin inserting them - preventing re-allocation of memory everytime you add another one.

    This should improve the speed significantly with the number of items (100,000) you suggest.

    Performance will also be impeeded if you've set the CListCtrl to sort the items.

    Stuart


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured