Space reservation increases json lib performance for the arrays with large number of entries.
Here is an example and discussion: https://reviews.llvm.org/D60609#1468941.
In short: there is json array with ~32K entries, one can build it using llvm::json::Array by pushing back each entry.
This pushing takes ~4% of whole time compared to the method of preliminary memory reservation: (3995-3845)/3995 = 3.75%.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
As i have previously discussed in IRC with @sammccall this change needs motivational numbers.
Just copying them (+methodology) from https://reviews.llvm.org/D60609#inline-538565 sounds good.
-5.5% sounds rather great to me.
Comment Actions
Thanks for gathering the numbers here, it is really useful to see how people are using this in performance-sensitive contexts. Definitely makes sense to fix this.