Speeding up interation within while not Eof loop 
Author Message
 Speeding up interation within while not Eof loop

I'm performing simple arithmetic calculations on an SQL result set
inside a while not Eof loop on an SQL Anywhere table. It's basically a
matter of checking on the one-character value of those fields and
incrementing a variable associated with each of 2-12 possible options.
A total of 86 fields are being processed, and the execution time is
about 25 seconds for 480 records on a fairly fast server.

The code is very straightforward, but the execution time seems very
slow. Are there tricks to speeding up this process?



Wed, 18 Jun 1902 08:00:00 GMT  
 Speeding up interation within while not Eof loop
Here's the answer to my own question. So far, I've found two things
that marginally speed up this loop. First, I've inserted a check for
blank records before each nested If statement. Second, I've replaced
several of the nested If statements with Case statements. I don't see
why it should be faster, but I've found that to be the result.


Wed, 18 Jun 1902 08:00:00 GMT  
 Speeding up interation within while not Eof loop


Quote:
> I'm performing simple arithmetic calculations on an SQL result set
> inside a while not Eof loop on an SQL Anywhere table. It's basically a
> matter of checking on the one-character value of those fields and
> incrementing a variable associated with each of 2-12 possible options.
> A total of 86 fields are being processed, and the execution time is
> about 25 seconds for 480 records on a fairly fast server.

> The code is very straightforward, but the execution time seems very
> slow. Are there tricks to speeding up this process?

If you are using a Query AND you are going only forward, you can try
setting the Unidirectional property to true. (I am not sure about the
property name but it is Unidirectional or ForwardOnly or something like
that, I have not Delphi in the office where I'm writing this post).

Hope this helps.

--
Marcelo Barbero

Sent via Deja.com http://www.deja.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Speeding up interation within while not Eof loop
Hi,

Couldn't you perform the same task with a single SQL statement? it may
also help
to create indices.

Regards,

Amir

Quote:

> I'm performing simple arithmetic calculations on an SQL result set
> inside a while not Eof loop on an SQL Anywhere table. It's basically a
> matter of checking on the one-character value of those fields and
> incrementing a variable associated with each of 2-12 possible options.
> A total of 86 fields are being processed, and the execution time is
> about 25 seconds for 480 records on a fairly fast server.

> The code is very straightforward, but the execution time seems very
> slow. Are there tricks to speeding up this process?



Wed, 18 Jun 1902 08:00:00 GMT  
 Speeding up interation within while not Eof loop
Thanks for the suggestion. Unfortunately, I know of no way to do the
calculations with a single SQL statement. For example, some fields
store three possible values. They may be P, N, or S. Other fields hold
different combinations. Others are true/false. I have to sum up the
answers across all possibilities within this routine so it probably
has to be done manually.


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. prompted read in WHILE not eof loop

2. SQL Question - updating within FOR loop

3. EOF marker not being recogized

4. Need help with an EOF not being found

5. Effective programming w/ loops...not getting it :(

6. Q:Posting changes within a transaction (Capability not Supported)

7. FOR-TO-DO loop not ri

8. Loop not working

9. FOR-TO-DO loop not right?

10. datacombobox not saving all the character even though it is within length of field length

11. New UPS System 6-8 Hours Continuous Service

12. Ups and Downs of OOP

 

 
Powered by phpBB® Forum Software