Jump to content

Fill a listview is slow


Recommended Posts

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

Link to comment
Share on other sites

Please have a look at this post.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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?

@+

Link to comment
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.

Link to comment
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().
Link to comment
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)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...