"Kate" <ka**@curio.com> wrote in message
news:2c**************************@posting.google.c om...
I have some 2-4D arrays that are filled by several different subs.
Instead of maintaining a global or module level counter, I'd rather
redim the array after each sub is finished, and start the next sub out
at ubound(ary).
The program is already getting sluggish and I'm looking for ways to
improve performance--is redimming the arrays adding an unnecessary
load?
BTW, if anyone has some good ways to investigate which parts of the
program are dragging it down, I'd appreciate any advice. I don't have
a performance monitor.
I'm using several data source/data consumer classes, but the
performance doesn't degrade more as I add more of those (or add more
datamembers to them), so I'm not sure if that's the problem.
Thanks--
Redim-Preserve an array means allocating a new, bigger block of memory,
copying the old block to the new block, and releasing the old block.
Whether that is a performance hit depends on how big the array is, how
much memory is available, and how the time involved compares to whatever
else you are doing. Several larger redims are usually preferable to lots
of smaller redims.
If you are using data sources, you might want to see whether retrieving
data is the main slow down, compared to array processing. It often is,
since it is disk/network intensive. As far as how to monitor, start with
a few Debug.Print "starting process X at " & Now and Debug.Print
"finished process X at " & Now, and then look harder at the processes
that take too long.
We always enjoy seeing some code and offering opinions on which bits
could be tweaked for performance...:)