473,399 Members | 4,254 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,399 software developers and data experts.

Conceptual and speed question

Hi,

My program seems to slow down drastically because as I fill my array and
table with many values, the program suffers tremendously. The first thing my
program does is to search the jagged array to try to find an element in that
array. If it does not find that element in that array, then it adds another
element and that is the problem. Once I have many elements in that array, it
takes a long time to do a search. Furthermore, not only do I add an element
to that array if it does not find it, but I also add it to my table and as
my table gets bigger, it also slows everything down drastically.

What I thought may be possible is to create many arrays instead of only 1
array and that would speed up the search. The problem is that I do not know
what the size of each array will be at the beginning as some of the arrays
might be much larger than others. Is there a way to declare arrays and then
to dynamically increase their size when needed, and if it is possible would
this hamper the performance because my arrays will be quite large. I also
thought of maybe sorting the array, but that would take too long. Is there a
way to index an array to speed up the search?

As for my table in the database, I was wandering if I created many tables
would that also help speed up the process or will it not make a difference
because it is in the same database. And if that is the case that it does not
make a difference in speed because it is in the same database, then can I
save it to a different database? Another possibility I thought of is to save
the rows to another database and delete the rows in original database after
a certain number of rows have been added.



TIA

Roy
Nov 18 '05 #1
2 1622
Roy,

Why not use ArrayLists or List<T> for the dynamic arrays? They will
allocate the space for you as needed (doubling the current capacity every
time more memory is needed).

Also, have you considered a hashtable for your lookup? It would
probably be MUCH quicker than cycling through all of the elements of the
array. You would probably have to create a custom hash code provider and
comparer (.NET 2.0 has something for this, I'm not sure if .NET 1.1 has
something, or it might be in two separate interfaces).

Personally, I'd use the hashtable/dictionary approach.

Either that, or, you could create a tree out of your jagged array, and
search through that.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Roy Gourgi" <ro***@videotron.ca> wrote in message
news:iL********************@wagner.videotron.net.. .
Hi,

My program seems to slow down drastically because as I fill my array and
table with many values, the program suffers tremendously. The first thing
my program does is to search the jagged array to try to find an element in
that array. If it does not find that element in that array, then it adds
another element and that is the problem. Once I have many elements in that
array, it takes a long time to do a search. Furthermore, not only do I add
an element to that array if it does not find it, but I also add it to my
table and as my table gets bigger, it also slows everything down
drastically.

What I thought may be possible is to create many arrays instead of only 1
array and that would speed up the search. The problem is that I do not
know what the size of each array will be at the beginning as some of the
arrays might be much larger than others. Is there a way to declare arrays
and then to dynamically increase their size when needed, and if it is
possible would this hamper the performance because my arrays will be quite
large. I also thought of maybe sorting the array, but that would take too
long. Is there a way to index an array to speed up the search?

As for my table in the database, I was wandering if I created many tables
would that also help speed up the process or will it not make a difference
because it is in the same database. And if that is the case that it does
not make a difference in speed because it is in the same database, then
can I save it to a different database? Another possibility I thought of is
to save the rows to another database and delete the rows in original
database after a certain number of rows have been added.



TIA

Roy

Nov 18 '05 #2
Hi Roy,

Another option : Can you sort your elements ? Searching elements in a
sorted list goes much faster. An overview :
http://en.wikipedia.org/wiki/Search_algorithm

succes,
Bart

http://www.xenopz.com/blog/bartdeboeck/

Nov 19 '05 #3

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

Similar topics

34
by: Jacek Generowicz | last post by:
I have a program in which I make very good use of a memoizer: def memoize(callable): cache = {} def proxy(*args): try: return cache except KeyError: return cache.setdefault(args,...
5
by: mACKnIFE | last post by:
Hi list! I've just finished reading the nice book: "Data Modeling and Relational Database Design Volume 1 - Student Guide", by Jan Speelpenning, Patrice Daux and Jeff Gallus, published by Oracle...
4
by: Daniel Ladd | last post by:
Hi, I have a problem with a conceptual graph in c++. I have a oist of structures like this: typedef struct Conceptual { char* Name;//Rappresenta la parola da mettere nel grafo Conceptual* Next;...
11
by: Sezai YILMAZ | last post by:
Hello I need high throughput while inserting into PostgreSQL. Because of that I did some PostgreSQL insert performance tests. ------------------------------------------------------------ --...
3
by: M_Mann | last post by:
Hello, Pls excuse if you consider this off-topic. Conceptual artists seek programmers here. We are authors of "Exhibition of Living Managers" (MANAGEX, www.managex.info) which is is global...
6
by: RSH | last post by:
I am still trying to grasp the use of real world Objects and how to conceptualize them using a business scenerio. What I have below is an outline that I am wrestling with trying to figure out a...
12
by: RSH | last post by:
I am still trying to grasp the use of real world Objects and how to conceptualize them using a business scenerio. What I have below is an outline that I am wrestling with trying to figure out a...
45
by: charles.lobo | last post by:
Hi, I have recently begun using templates in C++ and have found it to be quite useful. However, hearing stories of code bloat and assorted problems I decided to write a couple of small programs...
13
by: AliRezaGoogle | last post by:
Dear Members, I have a problem in the concepts of Monit.Enter and Monitor.Exit (Before everything I should say that I know how to solve this problem by using Monitor.Wait and I do not need a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.