diff options
author | Alexander Blair <snipa@jagtech.io> | 2020-08-16 12:43:10 -0700 |
---|---|---|
committer | Alexander Blair <snipa@jagtech.io> | 2020-08-16 12:43:11 -0700 |
commit | 009ca6fcd31a6152120692dca7392008091c5e94 (patch) | |
tree | 2bef7d5b95911b86054c6669209a30a36b9158eb /src/rpc/message.cpp | |
parent | Merge pull request #6593 (diff) | |
parent | Optimize ZMQ-JSON vector reading; GetBlocksFast reads 24%+ faster (diff) | |
download | monero-009ca6fcd31a6152120692dca7392008091c5e94.tar.xz |
Merge pull request #6601
98c151ecb Optimize ZMQ-JSON vector reading; GetBlocksFast reads 24%+ faster (Lee Clagett)
60627c9f2 Switch to insitu parsing for ZMQ-JSON; GetBlocksFast reads 13%+ faster (Lee Clagett)
fe96e66eb Fix pruned tx for ZMQ's GetBlocksFast (Lee Clagett)
Diffstat (limited to 'src/rpc/message.cpp')
-rw-r--r-- | src/rpc/message.cpp | 7 |
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(); |