[jawsscripts] Re: Resizing arrays

  • From: Doug Lee <doug.lee@xxxxxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Thu, 5 Jan 2012 16:12:21 -0500

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

-- 
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:doug.lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________�

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

Other related posts: