WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Arrays
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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)

Article ID:   W15445
File Created: 2003:05:13:11:27:54
Last Updated: 2003:05:13:11:27:54