Profile-guided optimization (PGO)

Johan Engelen via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Thu Dec 10 16:26:22 PST 2015


On Tuesday, 8 December 2015 at 22:41:22 UTC, David Nadlinger 
wrote:
> On 8 Dec 2015, at 23:35, Johan Engelen via digitalmars-d-ldc 
> wrote:
>> Thanks a lot for the testcase you posted on Github. Will sink 
>> my teeth in fixing that first.
>
> You're welcome – I hope it's enough information to reproduce 
> it, but I don't have a debug build of LLVM on this machine 
> right now.

After two more bug fixes: the regexp microbench now works.

Results with the regexp bench (bench.d):
> time ldc2 bench.d -O3 -of=bench_normal --> 52s
   time ./bench_normal --> 2.55s 98%cpu

> time ldc2 bench.d -fprofile-instr-generate -of=bench_instr --> 
> 11s
   time ./bench_instr --> 6.72s 99%cpu
   llvm-profdata merge default.profraw -o bench.profdata
   time ldc2 bench.d -O3 -fprofile-instr-use=bench.profdata 
-of=bench_pgo
     --> 48.35s
   time ./bench_pgo --> 2.48s 98%cpu

(timing numbers for bench_normal and bench_pgo are +- 0.01)

So PGO brings it from 2.55 to 2.48 sec, ~3% improvement.
Disappointing, but well... it works!




More information about the digitalmars-d-ldc mailing list