472,328 Members | 1,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

Redim computationally expensive?

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--
Jul 17 '05 #1
4 2786

"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...:)
Jul 17 '05 #2
> > 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.
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...:)

Really? From reading other posts, I had the impression nobody could
help me this way. How/to whom do I post it, and how should I
discriminate about the relevant bits? See, here's the deal: I had a
big messy program to clean up, and I learned a bit about component
design and using VB data sources/consumers as I was fixing the
program. So there is a bit of a mish-mash here (e.g., in one "half" of
the program--the drawing half--I made complex-bound data consumer
classes. In the second half, I dispensed with that and just used the
sources, since it seemed a bit less unwieldy. Now I'm wondering which
half might be in need of more tuning-up.)
Jul 17 '05 #3
"Kate" <ka**@curio.com> wrote
We always enjoy seeing some code and offering opinions on which bits
could be tweaked for performance...:)
Really? From reading other posts, I had the impression nobody could
help me this way. How/to whom do I post it, and how should I
discriminate about the relevant bits?


Isolate the problemed code. Make a small demo that demonstrates the
problems so that they can be reproduced on the systems of those who
would offer help.

Often times, while creating the demo, you can find the mistakes, or
clean up the code, to eliminate the problems. If not, you still have a
short demo you can post for others to try out.

Very few are going to want to look at several forms, half a dozen modules
and classes just to find a problem in one small area of a program. We
often need to see the actual code that causes the problem, to know what
the cause is, and especially to see where improvements might be offered.

LFS


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #4
On 21 Jan 2004 05:44:21 -0800, ka**@curio.com (Kate) wrote:

<snip>
Really? From reading other posts, I had the impression nobody could
help me this way. How/to whom do I post it, and how should I
discriminate about the relevant bits? See, here's the deal: I had a
big messy program to clean up, and I learned a bit about component
design and using VB data sources/consumers as I was fixing the
program. So there is a bit of a mish-mash here (e.g., in one "half" of
the program--the drawing half--I made complex-bound data consumer
classes. In the second half, I dispensed with that and just used the
sources, since it seemed a bit less unwieldy. Now I'm wondering which
half might be in need of more tuning-up.)


Your posts have been too vague for us to latch on to.

However one general bit of advice seems appropriate
- apply 'Occam's Razor'

Remove and fake bits until you see things improving
- collect data and then release a routine on a command button

Repeat that for all small parts of the App

When you find the bottleneck - post again
- but the chances are you will not need to - it will be obvious
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Trevor Fairchild | last post by:
I've got a program that parses text files. The text files come to me in Unicode and they contain goofy characters that VB chokes on - treats them...
2
by: Wayne Wengert | last post by:
I am trying to add one column to an existing array (code below). The ReDim command gives the error: -----------------------------------------------...
2
by: | last post by:
Is it correct to think that after reducing the populated array's size from say, 10 to 5 with redim preserve myArray(i) an attempt to access an...
4
by: Daryl Davis | last post by:
I am having trouble with ReDim (see code below) SaleTable2's structure includes an array for SaleDetailTable2 Dim newsale As New...
5
by: Zenobia | last post by:
Hello, I want to keep a list references to database records being accessed. I will do this by storing the record keys in a list. The list...
9
by: John A Grandy | last post by:
In VB6 you could get away with the following code: Dim Index As Integer Dim ItemsCount As Integer Dim StringArray() As String Dim StringValue...
5
by: Paul | last post by:
Off the cuff, does anyone know if arraylist is more efficeint at adding items to an array than redim preserve? Paul <begin loop> Dim c As...
19
by: Tom Jastrzebski | last post by:
Hello, I was just testing VB.Net on Framework.Net 2.0 performance when I run into the this problem. This trivial code attached below executed...
9
by: Anil Gupte | last post by:
I am having a problem using Multidim arrays. I want to create an array which as I understand it is dimensioned as: dim xyz (rows,columns) as...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.