[Zrouter-src] ZRouter.org: push to zconf++ zconf++/http_json_handler.cc
zrouter-src at zrouter.org
zrouter-src at zrouter.org
Wed Jan 11 06:01:35 UTC 2012
details: /rev/4e7e139aedde
changeset: 35:4e7e139aedde
user: "Nicolai Petri <nicolai at petri.dk>"
date: Wed Jan 11 06:57:43 2012 +0100
description:
Try to reserve a 16K buffer before building json reply to avoid reallocs
diffstat:
zconf++/http_json_handler.cc | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diffs (12 lines):
diff -r a97993aa111b -r 4e7e139aedde zconf++/http_json_handler.cc
--- a/zconf++/http_json_handler.cc Mon Jan 09 18:18:16 2012 +0100
+++ b/zconf++/http_json_handler.cc Wed Jan 11 06:57:43 2012 +0100
@@ -78,6 +78,8 @@
rep.content.append(ss.str().c_str(), ss.str().length());
#else
std::stringstream ss;
+ ss.str().reserve(16384); // Reserve 16K to avoid realloc hell on small request.
+ // TEST: Do above actually make a change ?
if (leaf->type() == action_leaf) {
Json::Reader r;
Leaf params;
More information about the Zrouter-src
mailing list