aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/message.cpp
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2020-05-29 22:08:19 -0400
committerLee Clagett <code@leeclagett.com>2020-08-14 19:46:59 +0000
commit60627c9f24f5c322c59abee7c8e9e03a2b2ccf5a (patch)
treea0dee7bae6708f24732aa8ed0e3da39de4729a8f /src/rpc/message.cpp
parentFix pruned tx for ZMQ's GetBlocksFast (diff)
downloadmonero-60627c9f24f5c322c59abee7c8e9e03a2b2ccf5a.tar.xz
Switch to insitu parsing for ZMQ-JSON; GetBlocksFast reads 13%+ faster
Diffstat (limited to 'src/rpc/message.cpp')
-rw-r--r--src/rpc/message.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rpc/message.cpp b/src/rpc/message.cpp
index e4f17cef8..3aefbd76e 100644
--- a/src/rpc/message.cpp
+++ b/src/rpc/message.cpp
@@ -79,9 +79,12 @@ void Message::fromJson(const rapidjson::Value& val)
GET_FROM_JSON_OBJECT(val, rpc_version, rpc_version);
}
-FullMessage::FullMessage(const std::string& json_string, bool request)
+FullMessage::FullMessage(std::string&& json_string, bool request)
+ : contents(std::move(json_string)), doc()
{
- doc.Parse(json_string.c_str());
+ /* Insitu parsing does not copy data from `contents` to DOM,
+ accelerating string heavy content. */
+ doc.ParseInsitu(std::addressof(contents[0]));
if (doc.HasParseError() || !doc.IsObject())
{
throw cryptonote::json::PARSE_FAIL();