Re: PostgreSQLv14 TPC-H performance GCC vs Clang

2021-11-05 Thread arjun shetty
Hi

@imre : Thank you sharing the links on “ Phoronix has been tested the
PostgreSQL 13”.
I compared my test results with Phoronix test suit” . It has too
deviations(may be hardware environment and PostgreSQL version)
I think PostgreSQLv13 may have issues with Auto vacuum and currently I’m
using with PostgreSQLv14


In my environment GCC performs better than Clang(llvm) the reason would  be
“int128”performance better in GCC compared to Clang.
1.Clang(__int128) require 4 additional functions like “__divti3 , __modti3,
__udivti3, __umodti3” and these additional not required in GCC . So it may
lead performance drop in Clang.
2.__int128 aligned 16 bytes boundaries (MAXALIGN) supported in GCC and may
this in not support in Clang

@postgresql- performance: kindly let know your view on those two points.





On Wednesday, November 3, 2021, Imre Samu  wrote:

> > .. optimisation flags like O3
> > And please suggest ...  to check on the performance difference
>
> The Phoronix has been tested the PostgreSQL 13 with Clang 12 + GCC 11.1 On
> Xeon Ice Lake
> *  "The CFLAGS/CXXFLAGS set throughout testing were "-O3 -march=native
> -flto" *
> *  as would be common for HPC systems when building performance sensitive
> code."*
> *and the results:*
>   https://www.phoronix.com/scan.php?page=article&item=clang12-
> gcc11-icelake&num=4 ( see ~ bottom of the page )
> only the Postgres ( GCC 11 vs. LLVM Clang 12 Benchmarks On Xeon Ice Lake )
>   https://openbenchmarking.org/result/2105299-IB-COMPILERT91&;
> sgm=1&ppt=D&sor&sgm=1&ppt=D&oss=Postgresql
>   maybe you can replicate the Phoronix results  ( but this is only gcc11.1
> ! )
>   "Compare your own system(s) to this result file with the Phoronix Test
> Suite
> by running the command: phoronix-test-suite benchmark
> 2105299-IB-COMPILERT91"
>
> Regards.
>   Imre
>
> arjun shetty  ezt írta (időpont: 2021. nov. 2.,
> K, 18:13):
>
>> Hi
>> PostgreSQLv14 source code build  with GCCv11.2 and Clangv12(without JIT)
>> with  optimisation flags like O3 and tested with HammerDB
>> Observed TPC-H , GCC performance better than Clang(without JIT). The
>> performance difference ~22% and also noticed the assembly code difference
>> GCC vs Clang( e.g. GCC inlined functionality compared to Clang).
>>
>> Environment details:
>> -
>> OS :RHEL8.4
>> Bare metal : Apple/AMD EPYC/IBM
>> Test(TPC-H) Benchmark Environment:HammerDB
>>
>> Is the performance difference mainly because of below points ?
>> 1 data over flow and calculations like int128(int128.c) and C arithmetic
>> operations(functions include in float.h e.g float4_mul)
>>
>> And please suggest is any another functionality or code points need to
>> check on the performance difference
>>
>


Re: PostgreSQLv14 TPC-H performance GCC vs Clang

2021-11-05 Thread Tomas Vondra

Hi,

IMO this thread provides so little information it's almost impossible to 
answer the question. There's almost no information about the hardware, 
scale of the test, configuration of the Postgres instance, the exact 
build flags, differences in generated asm code, etc.


I find it hard to believe merely switching from clang to gcc yields 22% 
speedup - that's way higher than any differences we've seen in the past.


In my experience, the speedup is unlikely to be "across the board". 
There will be a handful of affected queries, while most remaining 
queries will be about the same. In that case you need to focus on those 
queries, see if the plans are the same, do some profiling, etc.



regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company