summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Afanasyev <anton.a.afanasyev@gmail.com>2019-04-16 19:43:18 +0000
committerAnton Afanasyev <anton.a.afanasyev@gmail.com>2019-04-16 19:43:18 +0000
commit765f0183815556be357429dbc3421fcb00e0e920 (patch)
treebabf2237ffcfe8b958815bc3ba01f46d5b9644c5
parent82ffa88a04a7cb961e482387ec25d6fd0c51ce20 (diff)
downloadbcm5719-llvm-765f0183815556be357429dbc3421fcb00e0e920.tar.gz
bcm5719-llvm-765f0183815556be357429dbc3421fcb00e0e920.zip
[Support][JSON] Add reserve() to json Array
Summary: Space reservation increases json lib performance for the arrays with large number of entries. Here is the example and discussion: https://reviews.llvm.org/D60609#1468941 Reviewers: lebedev.ri, sammccall Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60788 llvm-svn: 358520
-rw-r--r--llvm/include/llvm/Support/JSON.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/JSON.h b/llvm/include/llvm/Support/JSON.h
index e3cb9506632..b2aaf68724d 100644
--- a/llvm/include/llvm/Support/JSON.h
+++ b/llvm/include/llvm/Support/JSON.h
@@ -179,6 +179,7 @@ public:
bool empty() const { return V.empty(); }
size_t size() const { return V.size(); }
+ void reserve(size_t S) { V.reserve(S); }
void clear() { V.clear(); }
void push_back(const Value &E) { V.push_back(E); }
OpenPOWER on IntegriCloud