This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by sammccall on Apr 16 2019, 4:37 PM.

Details

Summary

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%)

Diff Detail

Repository
rL LLVM

Event Timeline

sammccall created this revision.Apr 16 2019, 4:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 16 2019, 4:37 PM
sammccall updated this revision to Diff 195485.Apr 16 2019, 4:41 PM

tweak comments

sammccall updated this revision to Diff 195486.Apr 16 2019, 4:43 PM

OStream constructor is explicit

Harbormaster completed remote builds in B30658: Diff 195486.
anton-afanasyev accepted this revision.Apr 17 2019, 1:28 PM

Looks great, thank you!

This revision is now accepted and ready to land.Apr 17 2019, 1:28 PM
This revision was automatically updated to reflect the committed changes.