Modify

Opened 13 years ago

Closed 13 years ago

#2037 closed Bug (Fixed)

COM speed deterioration

Reported by: trancexx Owned by: trancexx
Milestone: 3.3.7.21 Component: AutoIt
Version: 3.3.7.18 Severity: None
Keywords: Cc:

Description

User Ascend4nt reported this.
http://www.autoitscript.com/forum/topic/95366-latest-beta/page__view__findpost__p__932030

So the beta COM interface has slowed down tremendously. I know there's been major changes, but this is a huge performance difference. I'm seeing between 4-5x slower speed on the code below on beta 3.3.7.18 and 3.3.7.19, versus the production 3.3.6.1..
(Use it with at least one folder with a few hundred or so items, thats where the performance difference is most noticeable):

; ==========================================================================================================================
; Func _ObjectSHFolderViewFromWin($hWnd)
;
; Returns an 'ShellFolderView' Object for the given Window handle
;
; Author: Ascend4nt, based on code by KaFu, klaus.s
; ==========================================================================================================================
 
Func _ObjectSHFolderViewFromWin($hWnd)
    If Not IsHWnd($hWnd) Then Return SetError(1,0,0)
    Local $oShell,$oShellWindows,$oIEObject,$oSHFolderView
 
    ; Shell Object
    $oShell=ObjCreate("Shell.Application")
    If Not IsObj($oShell) Then Return SetError(2,0,0)
 
;   Get a 'ShellWindows Collection' object
    $oShellWindows = $oShell.Windows()
    If Not IsObj($oShellWindows) Then Return SetError(3,0,0)
 
;   Iterate through the collection - each of type 'InternetExplorer' Object
 
    For $oIEObject In $oShellWindows
        If $oIEObject.HWND = $hWnd Then
            ; InternetExplorer->Document = ShellFolderView object
            $oSHFolderView=$oIEObject.Document
            If IsObj($oSHFolderView) Then Return $oSHFolderView
            Return SetError(4,0,0)
        EndIf
    Next
 
    Return SetError(-1,0,0)
EndFunc
 
; ==========================================================================================================================
; Func _ExplorerWinGetAllItems($hWnd)
;
;
; Author: Ascend4nt, based on code by klaus.s, KaFu
; ==========================================================================================================================
 
Func _ExplorerWinGetAllItems($hWnd)
    If Not IsHWnd($hWnd) Then Return SetError(1,0,'')
    Local $oSHFolderView,$oFolderItem,$oFolderItems
    Local $iTotal,$iCounter=2,$aItems[2] = [0, ""]
 
    $oSHFolderView=_ObjectSHFolderViewFromWin($hWnd)
    If @error Then Return SetError(@error,0,'')
 
;   Folder->FolderItems Collection
    $oFolderItems = $oSHFolderView.Folder.Items
    $iTotal = $oFolderItems.Count
 
    Dim $aItems[$iTotal+2]  ; 2 extra -> 1 for count [0], 1 for Folder path [1]
 
    $aItems[0]=$iTotal
;   ShellFolderView->Folder->Self as 'FolderItem'->Path
    $aItems[1]=$oSHFolderView.Folder.Self.Path
 
    For $oFolderItem In $oFolderItems
        $aItems[$iCounter] = $oFolderItem.Path
        $iCounter += 1
    Next
 
    Return SetExtended($iCounter-2,$aItems)
EndFunc   ;==>_ExplorerWinGetAllItems
 
 
; ==========================================================================================================================
; ==========================================================================================================================
 
#include <Array.au3>
 
ConsoleWrite("AutoIt Version:"&@AutoItVersion&@CRLF)
 
$aWinList=WinList("[REGEXPCLASS:^(Explore|Cabinet)WClass$]")
 
For $i = 1 To $aWinList[0][0]
    $iTimer=TimerInit()
    $aSelection = _ExplorerWinGetAllItems($aWinList[$i][1])
    ConsoleWrite("Time:"&TimerDiff($iTimer)&" ms"&@CRLF)
    _ArrayDisplay($aSelection, "Explorer Instance #" & $i & " / " & $aWinList[$i][0])
Next

Attachments (0)

Change History (1)

comment:1 Changed 13 years ago by trancexx

  • Milestone set to 3.3.7.21
  • Owner set to trancexx
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [6367] in version: 3.3.7.21

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain trancexx.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.