[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
This commit is contained in:
Anton Afanasyev 2019-04-16 19:43:18 +00:00
parent 82ffa88a04
commit 765f018381
1 changed files with 1 additions and 0 deletions

View File

@ -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); }