[PATCH] D60804: [Support] Add JSON streaming output API, faster where the heavy value types aren't needed.

Sam McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 16:38:43 PDT 2019


sammccall created this revision.
sammccall added reviewers: anton-afanasyev, lebedev.ri.
Herald added subscribers: llvm-commits, kristina.
Herald added a project: LLVM.

There's still a little bit of constant factor that could be trimmed (e.g.
more overloads to avoid round-tripping primitives through json::Value).
But this solves the memory scaling problem, and greatly improves the performance
constant factor, and the API should leave room for optimization if needed.

Adapt TimeProfiler to use it, eliminating almost all the performance regression
from r358476.

Performance test on my machine:
perf stat -r 5 ~/llvmbuild-opt/bin/clang++ -w -S -ftime-trace -mllvm -time-trace-granularity=0 spirit.cpp

Handcrafted JSON (HEAD=r358532 with r358476 reverted): 2480ms
json::Value (HEAD): 2757ms (+11%)
After this patch: 2520 ms (+1.6%)


Repository:
  rL LLVM

https://reviews.llvm.org/D60804

Files:
  include/llvm/Support/JSON.h
  lib/Support/JSON.cpp
  lib/Support/TimeProfiler.cpp
  unittests/Support/JSONTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60804.195483.patch
Type: text/x-patch
Size: 17027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190416/21707bd4/attachment.bin>


More information about the llvm-commits mailing list