[python-win32] Slow convert collection to list (search a fastway)

Mark Hammond skippy.hammond at gmail.com
Thu Feb 12 11:11:48 CET 2009


On 12/02/2009 6:58 PM, Michel Claveau wrote:
> Re!
>
>> You think 700 microseconds for a COM transaction is slow? Perhaps it
>> is your expectations that need adjusting.
>
> When I get an array of data (for example, numbers), the (same) list
> conversion (len=1000) take 0.07 s
> But with array of object, it is ten times more slow (0.7 s).
> In my appli, I have table with 100 rows and 10 cols. But, if I go up
> 1000 rows and 20 cols, it will become a long way to obtain satisfaction...

I'm afraid that I'm not too surprised creating a COM object is 10 times 
slower than creating a python integer object.  Do you really need all 
these objects as IDispatch objects?  Can you enumerate over them 
instead?  It is quite likely enumeration isn't as efficient as it could 
be, but updating win32com's semnatics wrt iterators etc is something I'd 
be keen to work on post pywin32-213 - which may not help you much 
immediately though...

Cheers,

Mark


More information about the python-win32 mailing list