OSDN Git Service

Time profiler: optimize json output time
authorAnton Afanasyev <anton.a.afanasyev@gmail.com>
Tue, 16 Apr 2019 20:36:56 +0000 (20:36 +0000)
committerAnton Afanasyev <anton.a.afanasyev@gmail.com>
Tue, 16 Apr 2019 20:36:56 +0000 (20:36 +0000)
commite7738cac23c4ab2720c74c1e47c010abceb5e617
treecf862d618dfb9667c2eb8d25aeaccf1e76ba6cf2
parent28e34c70efb9acd3c5c52e6630ec6cb73ff4b14e
Time profiler: optimize json output time

Summary:
Use llvm::json::Array.reserve() to optimize json output time. Here is motivation:
https://reviews.llvm.org/D60609#1468941. In short: for the json array
with ~32K entries, pushing back each entry takes ~4% of whole time compared
to the method of preliminary memory reservation: (3995-3845)/3995 = 3.75%.

Reviewers: lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60792

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358522 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/TimeProfiler.cpp