473,395 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 2829

"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 as eof markers. I have already been through this...
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: ----------------------------------------------- Microsoft VBScript runtime error '800a0009' ...
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 element above the fifth does not cause a...
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 hallsales.SaleTable2 Dim detail As New hallsales.SaleDetailTable2...
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 must not contain duplicate keys. So I check the...
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 As String '....
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 Integer = SomeArray.GetUpperBound(0) + 1 ReDim...
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 hundreds, if not thousand times faster in VB 6.0...
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 String I want to populate it with rows from a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.