Improved performance for epee serialization:

- Removed copy of field names in binary deserialization
  - Removed copy of array values in binary deserialization
  - Removed copy of string values in json deserialization
  - Removed unhelpful allocation in json string value parsing
  - Removed copy of blob data on binary and json serialization
This commit is contained in:
Lee Clagett 2019-11-04 01:06:01 +00:00
parent 411f1b0ee3
commit a9bdc6e4c4
7 changed files with 56 additions and 59 deletions

View file

@ -271,7 +271,7 @@ TEST(tor_address, epee_serializev_v2)
EXPECT_EQ(std::strlen(v2_onion), host.size());
host.push_back('k');
EXPECT_TRUE(stg.set_value("host", host, stg.open_section("tor", nullptr, false)));
EXPECT_TRUE(stg.set_value("host", std::move(host), stg.open_section("tor", nullptr, false)));
EXPECT_TRUE(command.load(stg)); // poor error reporting from `KV_SERIALIZE`
}
@ -322,7 +322,7 @@ TEST(tor_address, epee_serializev_v3)
EXPECT_EQ(std::strlen(v3_onion), host.size());
host.push_back('k');
EXPECT_TRUE(stg.set_value("host", host, stg.open_section("tor", nullptr, false)));
EXPECT_TRUE(stg.set_value("host", std::move(host), stg.open_section("tor", nullptr, false)));
EXPECT_TRUE(command.load(stg)); // poor error reporting from `KV_SERIALIZE`
}
@ -373,7 +373,7 @@ TEST(tor_address, epee_serialize_unknown)
EXPECT_EQ(std::strlen(net::tor_address::unknown_str()), host.size());
host.push_back('k');
EXPECT_TRUE(stg.set_value("host", host, stg.open_section("tor", nullptr, false)));
EXPECT_TRUE(stg.set_value("host", std::move(host), stg.open_section("tor", nullptr, false)));
EXPECT_TRUE(command.load(stg)); // poor error reporting from `KV_SERIALIZE`
}