vlang/v

Use PGO in -prod

medvednikov opened this issue · 4 comments

10% faster:

Benchmark #1: ./v -o v.c cmd/v
  Time (mean ± σ):     207.1 ms ±   2.9 ms    [User: 162.3 ms, System: 43.9 ms]
  Range (min … max):   203.0 ms … 217.3 ms    100 runs


Benchmark #1: ./v2 -o v.c cmd/v
  Time (mean ± σ):     222.8 ms ±   3.4 ms    [User: 175.9 ms, System: 44.9 ms]
  Range (min … max):   217.9 ms … 232.6 ms    100 runs
./v -cc clang -o v cmd/v -cflags "-O3 -flto -fprofile-generate=profile" && ./v -o v.c cmd/v && llvm-profdata merge -output=code.profdata profile/ && ./v -cc clang -o v cmd/v -cflags "-O3 -flto -fprofile-use=code.profdata"

Thanks @ka-weihe

I don't think PGO can be used in -prod, because you have to compile the program with -fprofile-generate= first, and then run the program to generate data before building the final binary with -fprofile-use=.

So will need another flag and/or enable this in v self -prod

Speaking of -prod optimizations - how about #3424 if there is no @live function in the source (which is actually the vast majority of scenarios)?

Sounds good @dumblob

Any updates on integrating PGO into the compiler and/or V build scripts?