[PATCH] D60788: [Support][JSON] Add reserve() to json Array
Anton Afanasyev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 16 11:11:45 PDT 2019
anton-afanasyev created this revision.
anton-afanasyev added reviewers: lebedev.ri, sammccall.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D60788
Files:
llvm/include/llvm/Support/JSON.h
Index: llvm/include/llvm/Support/JSON.h
===================================================================
--- llvm/include/llvm/Support/JSON.h
+++ llvm/include/llvm/Support/JSON.h
@@ -179,6 +179,7 @@
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); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60788.195419.patch
Type: text/x-patch
Size: 423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190416/9518eefb/attachment.bin>
More information about the llvm-commits
mailing list