× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This is why I was kind of taken back by this. I had thought that there
wouldn't be a difference... or maybe ever so slight.


Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777



"Chris Hird" <chrish@xxxxxxxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
06/17/2011 10:14 AM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>


To
"'RPG programming on the IBM i / System i'" <rpg400-l@xxxxxxxxxxxx>
cc

Subject
RE: Performance test: DOW vs FOR.... interesting results...






I just did a quick check in C to see if there are any differences.

First result is for loop second Do While. I ran the same test 3 times to
see what differences are. The only difference is the time taken to run the
API to collect the seconds value.

Seconds used = 0.009001
Seconds used = 0.008001
Press ENTER to end terminal session.
Seconds used = 0.008999
Seconds used = 0.007999
Press ENTER to end terminal session.
Seconds used = 0.008001
Seconds used = 0.008001
Press ENTER to end terminal session.

Code

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ledate.h>

int main(int argc, char **argv) {
int i = 0;
int junkl;
int Num_Days = 30;
double start_secs;
double end_secs;
unsigned char junk2[23]; /* Junk char string */

CEELOCT(&junkl, &start_secs,junk2,NULL);
for(i = 0; i < 1000000; i++);
CEELOCT(&junkl, &end_secs,junk2,NULL);
printf("Seconds used = %f\n",end_secs - start_secs);
i = 0;
CEELOCT(&junkl, &start_secs,junk2,NULL);
do {
i++;
}while(i < 1000000);
CEELOCT(&junkl, &end_secs,junk2,NULL);
printf("Seconds used = %f\n",end_secs - start_secs);
exit(0);
}

I know this is not RPG but I thought it would add some additional
information. The for and do loop are doing the same thing because 'i' is
incremented everytime in both instances and the check ofr the value of 'i'
is done on each iteration. Just thought it would be interesting and it
shows the RPG implementation has some differences not found in the C
compiler??

Chris...
______________________________________________________
Please consider the environment before printing this email.

This message, including any attached documents, is intended for the
addressees only. It may contain information that is confidential,
privileged
and/or exempt from disclosure. No rights to privilege or confidentiality
have been waived. Any unauthorized use or disclosure is prohibited. If you
have received this message in error, please reply to the sender by e-mail
and delete or destroy all copies of this message.
______________________________________________________
Avant d'imprimer ce courriel, pensez à l'environnement.

Ce message, incluant tous les documents joints, est à l'intention des
destinataires visés seulement. Il peut contenir des renseignements
confidentiels, protégés et/ou ne pouvant pas être divulgués. Aucune
renonciation n'est faite quant à sa nature confidentielle et privilégiée.
Par conséquent, toute diffusion ou utilisation non autorisée est
strictement
interdite. Si vous avez reçu ce message par erreur, veuillez en aviser
immédiatement l'expéditeur par retour de courriel et en détruire toutes
les
copies existantes.


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Bryce Martin
Sent: June-17-11 9:37 AM
To: RPG programming on the IBM i / System i
Subject: Performance test: DOW vs FOR.... interesting results...

Ok, so out of curiosity yesterday I was doing some DOW vs FOR comparisons
and thought that while I was at it I would do a performance test...and
this
uncovered something interesting...

Here's the long of the short of it...
DOW is 3x faster than FOR. If you use OPTIMIZE(*FULL) then the gap is
even
greater.

Now, before anyone says it... yes...we're talking about milliseconds here.

But think of all your programs that have loops...yep, almost all of them.

So I guess my main question is this...

Why the big relative difference? How is it that FOR can be so much worse
than DOW? You can actually see a difference if doing 10's or 100's of
millions of iterations. So while most people won't see a difference in
individual instances, if all your FOR loops were 3 times faster in all
your
programs, I can't help but think you might be able to see some actual
performance across a fairly taxed system.

I don't know... just ruminating. Anybody have any gritty details?

See this link for code and discussion....
http://www.code400.com/forum/showthread.php/10499-DOW-x-lt-y-is-3-times-fast

er-than-using-for-x-number-downto-1


Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777
--- This message (including any attachments) is intended only for the use
of
the individual or entity to which it is addressed and may contain
information that is non-public, proprietary, privileged, confidential, and
exempt from disclosure under applicable law. If you are not the intended
recipient, you are hereby notified that any use, dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this communication in error, please notify us and
destroy
this message immediately. ---
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or
change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



--- This message (including any attachments) is intended only for the use of the individual or entity to which it is addressed and may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us and destroy this message immediately. ---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.