solid performance improvement when using clang

solid performance improvement when using clang

Return to topic list

Sat Nov 6 21:11:40 2021   by   Mizuki
$ gcc planet.c -O2 -o planet.exe
planet.c: In function 'main':
planet.c:318:3: warning: implicit declaration of function 'setmode'; did you mean 'setfmode'? [-Wimplicit-function-declaration]
  318 |  setmode(fileno(outfile), OBINARY);
      |  ~~~
      |  setfmode

$ ./timep.exe planet.exe -s 0.525412 -w 2500 -h 1250 -o 525412.bmp
Real Time: 00:00:23.765
User Time: 00:00:22.687
Sys Time:  00:00:00.109

$ clang planet.c -O2 -o planetc.exe
planet.c:318:3: warning: implicit declaration of function 'setmode' is invalid in C99 [-Wimplicit-function-declaration]
  setmode(fileno(outfile), OBINARY);
  ^
planet.c:628:9: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
    if (abs(lat) >= PI - 0.000001) view = 's';
        ^
planet.c:628:9: note: use function 'fabs' instead
    if (abs(lat) >= PI - 0.000001) view = 's';
        ~
        fabs
2 warnings generated.

$ ./timep.exe planetc.exe -s 0.525412 -w 2500 -h 1250 -o 525412.bmp
Real Time: 00:00:20.390
User Time: 00:00:19.546
Sys Time:  00:00:00.125
 
Mon Nov 8 11:24:21 2021   by   Torben
Thanks.  I get a similar speedup on my computer (from 4.6s to 4.0s. user time).

I will handle the warnings in the next release.
 

Return to topic list



New message:
Topic:
Posted by:

Type the values of the dice shown below:

Return to topic list