My program is grinding to a hault

Please discuss general Delphi programming topics here.

My program is grinding to a hault

Postby Wardlow » June 22nd, 2007, 12:02 am

Hi,

I know that this is a very vague question to ask, however I was wondering often this is the result of a common thing.

I am running through a BIG loop from 2 to 50. Inside the loop there are smaller loops and it. THis is what is happening. The first loop takes .1 seconds, 2nd loop takes .2 seconds and it keep on getting slower and slower until at loop 25 it's taking about 5 seconds to complete it. Now all the loops should take the same time.

Would anyone have any general comments to make on this or would you have to see the code in order to determine what is going on?

Thanks
Wardlow
Junior Member
Junior Member
 
Posts: 38
Joined: May 31st, 2007, 10:08 pm

Postby Wardlow » June 22nd, 2007, 12:27 am

ya know I just figured it out. I remember reading that you should pass your arrays my reference because the computer has to make a copy of the whole array to pass in a function.

I usually do this, but I forgot the var part, and as the array got larger and larger so did the amount of copying that I had to do.
Wardlow
Junior Member
Junior Member
 
Posts: 38
Joined: May 31st, 2007, 10:08 pm

Postby Kambiz » June 22nd, 2007, 5:04 am

It's very good that you could resolve the problem. =D>
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 8 guests

cron