P
Pi
I'm looking at a piece of code that gets called over
100,000 times and was wondering if there would be much
performance difference between these three scenarios or
is there an alternate approach?:
== Scenario 1: ==
Dim colA as new Collection 'Collection of clsA objects
<Add 10-20 clsA objects to colA collection>
Outside Loop (100,000 times)
<code>
For Each A as clsA in colA
<code>
Next
<code>
End Outside Loop
== Scenario 2: ==
Dim arrA as Array 'Array of clsA objects
<Redimension arrA and add 10-20 clsA objects>
Outside Loop (100,000 times)
<code>
For each A as clsA in arrA
<code>
Next
<code>
End Outside Loop
== Scenario 3: ==
Dim arrA as Array 'Array of clsA objects
<Redimension arrA and add 10-20 clsA objects>
Outside Loop (100,000 times)
<code>
For i as integer = 0 to arrA.Length - 1
<code using arrA(i)>
Next
<code>
End Outside Loop
100,000 times and was wondering if there would be much
performance difference between these three scenarios or
is there an alternate approach?:
== Scenario 1: ==
Dim colA as new Collection 'Collection of clsA objects
<Add 10-20 clsA objects to colA collection>
Outside Loop (100,000 times)
<code>
For Each A as clsA in colA
<code>
Next
<code>
End Outside Loop
== Scenario 2: ==
Dim arrA as Array 'Array of clsA objects
<Redimension arrA and add 10-20 clsA objects>
Outside Loop (100,000 times)
<code>
For each A as clsA in arrA
<code>
Next
<code>
End Outside Loop
== Scenario 3: ==
Dim arrA as Array 'Array of clsA objects
<Redimension arrA and add 10-20 clsA objects>
Outside Loop (100,000 times)
<code>
For i as integer = 0 to arrA.Length - 1
<code using arrA(i)>
Next
<code>
End Outside Loop