Sign in to follow this  
Followers 0
Michel Claveau

Fill a listview is slow

10 posts in this topic

Hi!

Fill listview is (very) slow (I think more than 10000 lines & 10 col)

Because there are many (100000) _SendMessage($hWnd, $LVM_SETITEMW, 0, $pItem, 0, "wparam", "ptr")

I search a way for fast fill a listview (perhaps if we send a big struct?)

Any idea?

Thank you in advance

Share this post


Link to post
Share on other sites



Please have a look at this post.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi!

Sorry for delay.

Thank you for answers.

I made various tests. The more fast is:

Func lv_AddArray($h, $hh, ByRef $aItems, $limite=29999)
     ;;;memo:$hh=GUICtrlGetHandle($h)
     Local $i,$nb,$nbvisu
     $nb=UBound($aItems)-1
     $nbvisu=50
     ;_SendMessage($hh, $LVM_DELETEALLITEMS) 

     _SendMessage($hh,$WM_SETREDRAW,0,0) 
     For $i=0 To _Min($nbvisu,$nb)
          GUICtrlCreateListViewItem($aItems[$i], $h)
     Next
     _SendMessage($hh,$WM_SETREDRAW,1,0)
     If $nb>$nbvisu Then
          _SendMessage($hh,$WM_SETREDRAW,0,0)
          For $i=$nbvisu+1 to $nb
               GUICtrlCreateListViewItem($aItems[$i], $h)
          Next
          _SendMessage($hh,$WM_SETREDRAW,1,0)
     EndIf
EndFunc

This routine calculates 50 lines, shows them, then calculates the rest (better aspect/depiction for users)

But it remains slow. And, nevertheless my old (2 years) laptop is 3 times as fast as the machine of Zedna... (tested with his example)

It remains slow...

Other thing: ReDraw+GUICtrlCreateListViewItem change the size of columns (with data's length).

_SendMessage($h, $LVM_SETITEMW... do not change the size, but it is more slow.

Perhaps a ReDraw+GUICtrlCreateListViewItem who do not change the size of columns would it be faster?

@+

Share this post


Link to post
Share on other sites

>_< Supper speed. You can use GUICtrlSendMsg() if the control is AutoIt native control, i.e. GUICtrlCreate*.

Share this post


Link to post
Share on other sites

Hi!

Posted Image Supper speed. You can use GUICtrlSendMsg() if the control is AutoIt native control, i.e. GUICtrlCreate*.

GUICtrlSendMsg() is more slow than _SendMessage()

If you do not want my trick "display immediate and calculate next", the fastest means which I found is:

Func lv_AddArray($h, $hh, ByRef $aItems, $limite=9999)
    Local $i
    _SendMessage($hh,$WM_SETREDRAW,0,0)
    ;_SendMessage($hh, $LVM_DELETEALLITEMS) 
    For $i in $aItems
        GUICtrlCreateListViewItem($i, $h)
    Next
    _SendMessage($hh,$WM_SETREDRAW,1,0)
EndFunc

But, it remains still too slow for my needs.

Share this post


Link to post
Share on other sites

Hi!

GUICtrlSendMsg() is more slow than _SendMessage()

If you do not want my trick "display immediate and calculate next", the fastest means which I found is:

Func lv_AddArray($h, $hh, ByRef $aItems, $limite=9999)
    Local $i
    _SendMessage($hh,$WM_SETREDRAW,0,0)
    ;_SendMessage($hh, $LVM_DELETEALLITEMS) 
    For $i in $aItems
        GUICtrlCreateListViewItem($i, $h)
    Next
    _SendMessage($hh,$WM_SETREDRAW,1,0)
EndFunc

But, it remains still too slow for my needs.

You can hardly do faster than that. This is in principle the same as _GUICtrlListView_AddItem().

Share this post


Link to post
Share on other sites

_WinAPI_PostMessage() seems to be faster if you're not expecting to receive the result.

Share this post


Link to post
Share on other sites

Hi!

You can hardly do faster than that. This is in principle the same as _GUICtrlListView_AddItem().

Ok, but, in the doc of _GUICtrlListView_AddItem, I read: "You can not use this function to insert subitems"

and "Use _GUICtrlListView_AddSubItem" but this is very very slow, even if it is hard(trans)coded.

Добрый вечер (je ne parle pas russe ; merci à Reverso)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0