[PATCH] D60609: Use native llvm JSON library for time profiler output

Anton Afanasyev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 05:02:02 PDT 2019


anton-afanasyev added a comment.

In D60609#1465351 <https://reviews.llvm.org/D60609#1465351>, @lebedev.ri wrote:

> In D60609#1465327 <https://reviews.llvm.org/D60609#1465327>, @takuto.ikuta wrote:
>
> > I think it is true that json library is slower than just naive json output.
> >  But this code run one time in a compile and should have relatively few json objects.
> >  So visible performance effect will be low. Taking stats sounds good and I'm surprised if this patch change clang performance match.
>
>
> Yes, that is my hope too, but given history i'd like to be confident :)
>  This will really depend on the number of the entries in the output.
>  I'd like to see perf measurements on some large compiler invocation, with *many* of these entries in output json report.


I've measured time performance for the large source file `test-suite/SingleSource/Benchmarks/Misc-C++-EH/spirit.cpp`.

Five tests: without time tracing, with time tracing for old/new json output, with small granularity for old/new json output. Small time granularity leads to many entries in json output (~32K vs ~2K for default granularity).
As one can see, json library is actually slower but it has no notable effect by default and I believe it's eligible price even for large number of entries.

  perf stat -r 5 ./build_rel_base/bin/clang++ -w -S spirit.cpp
  ...
  3362.032795      task-clock (msec) 

  perf stat -r 5 ./build_rel_base/bin/clang++ -w -S -ftime-trace spirit.cpp
  ...
  3577.592945      task-clock (msec)

  perf stat -r 5 ./build_rel_exp/bin/clang++ -w -S -ftime-trace spirit.cpp
  ...
  3582.747398      task-clock (msec)

  perf stat -r 5 ./build_rel_base/bin/clang++ -w -S -ftime-trace -mllvm -time-trace-granularity=0 spirit.cpp
  ...
  3634.623793      task-clock (msec)



  perf stat -r 5 ./build_rel_exp/bin/clang++ -w -S -ftime-trace -mllvm -time-trace-granularity=0 spirit.cpp
  ...
  3995.315749      task-clock (msec)




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60609/new/

https://reviews.llvm.org/D60609





More information about the llvm-commits mailing list