This philosophy was applied in other programming languages even before Python appeared, so better said... what Donald Knuth said... "Premature optimization is the root of all evil". :-) --Octavian ----- Original Message ----- From: "Jamal Mazrui" <empower@xxxxxxxxx> To: <jawsscripts@xxxxxxxxxxxxx> Cc: "Andrew Hart" <ahart@xxxxxxxxxxxxx> Sent: Friday, January 06, 2012 1:47 PM Subject: [jawsscripts] Re: Resizing arrays >I agree that many consecutive COM calls, e.g., in a loop, can have a > noticeable effect on performance. In my opinion, however, such > performance degradation is usually not noticeable in screen reader > scripting scenarios. I am not saying that there are not occasions where > this is a concern, but for the most part, the delays of user interface > events and speech make COM delays negligible by comparison. > > In addition, the benefits of powerful COM techniques should also be > weighed. The .NET ArrayList, for example, provides all the flexibility > and dynamism that the original message on this topic was seeking. > Elements of any data type may be added or removed from an ArrayList with > ease via dedicated, well-tested methods. The list may be easily sorted, > reversed, or searched by other methods. > > One could take the time to write a lot of custom JAWS functions that try > to achieve this functionality, and it would be time consuming, > error-prone, and still short of the same functionality. One of the > strengths of Windows compared to other platforms is the many, built-in > object models that COM clients in any language can exploit. I agree > with the philosophy from the Python programming world: code to solve a > problem first, and then only optimize later if demonstrably needed for > performance. > > Jamal > > On 1/5/2012 2:59 PM, Andrew Hart wrote: >> 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 >> > __________� > > 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