|
From: David M. <ci...@ya...> - 2003-08-05 23:44:21
|
Ok here is a test I tried on a OLD comp I have lying
around.
System specifications:
25Mhz 486 (no math co-processor)
4Mb Ram
Compiled using the Pacific C compiler (djgpp runs WAY too
slow) using full
optimization.
Program:
#include <stdio.h>
#include <time.h>
long getint(void);
int main()
{
time_t begin,end;
long i, get_int;
begin = time(NULL);
for(i = 0; i < getint(); ++i);
end = time(NULL);
printf("Function call time taken = %i\n", end - begin);
get_int = getint();
begin = time(NULL);
for(i = 0; i < get_int; ++i);
end = time(NULL);
printf("Varible buffer time taken = %i\n", end - begin);
return 0;
}
long getint(void)
{
return 50000000;
}
Output:
Function call time taken = 40
Varible buffer time taken = 16
Hope this helps.
----- Original Message -----
From: "OROSZI Balázs" <or...@vp...>
To: <dev...@li...>
Sent: Tuesday, August 05, 2003 3:17 PM
Subject: Re: [Dev-C++] loop optimization
> Graham Douglas wrote:
> > Run the profiler to find out where the inefficiencies
are. In my
> > experience, any attempt to prejudge optimisation will
be wrong. The
> > inefficiencies are _never_ where you expect.
> >
> > The two fundamental rules for optimising by hand are:
> >
> > rule 1: don't do it.
> > rule 2: don't do it - yet.
>
> Thanks. Advice taken :)
>
> --
> Greetings,
> Balázs
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET
sites including
> Data Reports, E-commerce, Portals, and Forums are
available now.
> Download today and enter to win an XBOX or Visual Studio
.NET.
>
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE:
http://www23.brinkster.com/noicys/devcpp/ub.htm
>
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
|