|
From: <or...@vp...> - 2003-08-06 11:53:03
|
David McKen wrote:
> 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.
Thank you very much. Actually, I was also doing some benchmarks, and got
the same result as you. However, that getint() function is not that
simple :) It does something more complicated.
Anyway, thanks for it.
--
Greetings,
Balázs
|