[cfe-dev] Clang build of PostgreSQL

Argyrios Kyrtzidis kyrtzidis at apple.com
Thu Jun 23 14:32:55 PDT 2011


On Jun 23, 2011, at 2:07 PM, Peter Geoghegan wrote:

> On 23 June 2011 21:47, Sean McBride <sean at rogue-research.com> wrote:
> 
>> Those numbers are for gcc 4.2, and probably Apple's fork thereof.  One would assume the gcc folks have made improvements in 4.6, which you used.
> 
> I do appreciate that, and that a different optimisation level has been
> used, but I found the gap in compile times surprising, to the extent
> that I suspect that something is wrong.
> 
> Regardless of its performance, I do really like Clang from a usability
> perspective, FWIW.
> 
> Observe the differences in compile times of the file
> /src/backend/parser/gram.c . The warning message that you see is a
> known bug with Gnu Bison that they refuse to fix:
> 
> [peter at peter postgresql]$ time /home/peter/build/Release/bin/clang -O2
> -Wall -Wmissing-prototypes -Wpointer-arith
> -Wdeclaration-after-statement -Wendif-labels -Wformat-security
> -fno-strict-aliasing -fwrapv -Wno-error -I. -I. -I
> /home/peter/postgresql/src/include -D_GNU_SOURCE   -c -o gram.o
> /home/peter/postgresql/src/backend/parser/gram.c
> In file included from gram.y:12939:
> scan.c:16246:23: warning: unused variable 'yyg' [-Wunused-variable]
>    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be ...
>                      ^
> 1 warning generated.
> 
> real	1m5.660s
> user	1m5.344s
> sys	0m0.083s
> [peter at peter postgresql]$ time gcc -O2 -Wall -Wmissing-prototypes
> -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
> -Wformat-security -fno-strict-aliasing -fwrapv -Wno-error -I. -I. -I
> /home/peter/postgresql/src/include -D_GNU_SOURCE   -c -o gram.o
> /home/peter/postgresql/src/backend/parser/gram.c
> In file included from gram.y:12939:0:
> scan.c: In function ‘yy_try_NUL_trans’:
> scan.c:16246:23: warning: unused variable ‘yyg’ [-Wunused-variable]
> 
> real	0m2.800s
> user	0m2.688s
> sys	0m0.094s
> 
> That's obviously a difference way out of proportion to the total
> difference in compile times.

Maybe precompiled headers are not utilized when building with clang ? Clang does not automatically pick up the PCH from the first #include, you have to provide it at command-line.

> 
> -- 
> Peter Geoghegan       http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training and Services
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list