: :
Make a mode for adding a lot of items, so you do not draw for every item:
: :
: : MyListView lv;
: :
: : lv.BeginFillItems (); // Apply non-drawing mode
: :
: : for (int i=0; i<10000; i++) {
: : lv.AddItem (...);
: : }
: :
: : lv.EndFillItems (); // Apply drawing mode back and refresh in full
: :
: : I once had interesting experience: replacing strcmp() with my own code gave me almost 4 times speed up in sorting.
: :
:
: Well, if you're adding items beyond the visible lines the control will not redraw its contents. But this idea is great. I'll try to use that too. Thanks :) As for adding a lot of items the list has a message LLM_SETITEMCOUNT which will reserve extra memory.
:
: I once read an article that took up the subject of comparing strings. From what I know it's best to compare the first letters and if their equal do anything you need to do. E.g. :
:
:
: int result=str1[0]-str2[0];
: if( result == 0 )
: return CompareStr(...);
: else
: if( result > 0 )
: return FirstGreater;
: else
: return SecodGreater;
:
:
: That saves about 33% time because it doesn't have to use "call" instruction. This method would not work for non-ascii letters, for example in my language ( polish :) this is not enough. But I'm still working on it...
:
Great stuff!