G
Guest
I've been told that how one does a loop in VB .NET cna have significant speed
differernces. For example:
dim therows() as datarow
.....
dim row as datarow
for each row in therows
.....
next row
------------------------
vs.
-----------------------
dim therows() as datarow
.....
dim i as integer
for i = o to therows.getupperbound(0)
.....
next i
with the classic "for i=1 to next i" being much slower. Some testing on
really large string arrays confirms this. But we've heard otherwise, too.
And what about "while" loops, other ways of looping?
I suppose, too, it could have something to do with how data in an array,
rows in a dataset, etc, are indexed, not just how the counter gets
incremented.
Any articles, etc. on this?
differernces. For example:
dim therows() as datarow
.....
dim row as datarow
for each row in therows
.....
next row
------------------------
vs.
-----------------------
dim therows() as datarow
.....
dim i as integer
for i = o to therows.getupperbound(0)
.....
next i
with the classic "for i=1 to next i" being much slower. Some testing on
really large string arrays confirms this. But we've heard otherwise, too.
And what about "while" loops, other ways of looping?
I suppose, too, it could have something to do with how data in an array,
rows in a dataset, etc, are indexed, not just how the counter gets
incremented.
Any articles, etc. on this?