Arrays vs. Item Lists (Speed)
Keywords: Arrays vs. Item Lists (Speed)
Question:
I have a list of 1000+ LDAP paths that I am working with (contained in a variable). Right now, each individual path is extracted using 'ItemExtract' in a for..next loop. If I converted the list to an Array using 'Arrayize' and pulled the array elements in a for..next loop, would this be faster? In general, are arrays faster than item lists?Answer:
Ummm. Hmmm. There is not too much "in general" about anything. What the situation is is that many items are optimized for smaller data structures, so for a list of, say, ten items, the ItemExtract is probably better.However with lots of data, different factors come into play. And thus I think perhaps you could try the Arrayize and use arrays to step thru your data. It may be more efficient in the case you describe.
Here's some code to time code to speed differences:
Decimals(3) beginetime=GetTickCount() ;all your code goes here endtime=GetTickCount() timeinseconds=(endtime-begintime)/1000.0 Message("Time",timeinseconds)