[jawsscripts] Re: Resizing arrays

  • From: Andrew Hart <ahart@xxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Thu, 05 Jan 2012 19:59:43 -0300

COM object calls are generally more expensive than calls to routines
internal to an application.  There's all the overhead involved in
marshalling cross-process references and the like to deal with.
consequently, if you have to make lots and lots of COM calls, the COM
overhead will become apparent.  I expect this is what you were
observing.  the same is true of out-of-proc servers.  Inproc servers
should suffer less, since they are loaded directly into the address
space of the calling process and hence calls are straight forward, but
unfortunately, JAWS Script doesn't know how to talk to dll's directly,
only COM automation objects.

Cheers,
Andrew.

On 5/01/2012 6:12 PM, Doug Lee wrote:
> I got quite a shock a couple months or so ago on the subject of using
> COM objects versus collections, and I assume my results would apply
> reasonably equally to JAWS arrays when compared to COM objects.
> 
> Unfortunately I remember niether specific results nor the location of
> any written copy of them, but I do remember finding that tests
> involving over 500 references to a collection versus a COM object,
> Scripting.Dictionary in my case, produced such wildly different
> performance results to indicate clearly in favor of collections over
> COM objects. People have been saying this for years, but honestly, I
> didn't think it was a big enough deal until I did those tests. It
> would be handy for me if someone out there could prove me wrong,
> because I have a lot of code that uses Scripting.Dictionary, predating
> collections of course. But I currently operate with the assumption
> that Scripting.Dictionary objects are costly enough to avoid for loops
> that run, say, more than 50 times.
> 
> On Thu, Jan 05, 2012 at 04:05:27PM -0500, Jamal Mazrui wrote:
> Another approach is to use the ArrayList class of the .NET Framework, 
> which a JAWS script can access via COM.  Almost any Windows computer these 
> days has at least .NET 2.0, which includes this class.  The progID to pass 
> to the CreateObject function is "System.Collections.ArrayList."  The 
> methods and properties of the object thus instantiated are documented at
> 
> http://msdn.microsoft.com/en-us/library/system.collections.arraylist.aspx
> 
> This approach has the advantage of working with any JAWS version.
> 
> Similarly, for dictionary as opposed to list collections, it may be worth 
> considering use of the Scripting.Dictionary class of the Windows Script 
> Host, available on any Windows computer.  The progID is 
> "Scripting.Dictionary."  Such an object is documented at
> 
> http://msdn.microsoft.com/en-us/library/x4k5wbx4(VS.85).aspx
> 
> A couple more useful web pages on this topic are as follows:
> 
> http://www.robvanderwoude.com/vbstech_data_arraylist.php
> 
> http://halfloaded.com/blog/net-classes-within-vbscript-doing-randomness-and-arrays-the-easy-way/
> 
> Jamal
> 
> __________???
> 
> View the list's information and change your settings at 
> //www.freelists.org/list/jawsscripts
> 


__________�

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: