Skip to content

Commit

Permalink
[Support][JSON] Add reserve() to json Array
Browse files Browse the repository at this point in the history
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
  • Loading branch information
anton-afanasyev committed Apr 16, 2019
1 parent 82ffa88 commit 765f018
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions llvm/include/llvm/Support/JSON.h
Expand Up @@ -179,6 +179,7 @@ class Array {

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); }
Expand Down

0 comments on commit 765f018

Please sign in to comment.