Load the serialized representation from file once

The previous implementation had each sampling run reading from the
serialized file. This introduced a large I/O overhead and the
performance was much slower than the equivalent run with the
unserialized source.
This commit is contained in:
Dan Short 2020-07-31 13:25:46 +01:00
parent d4e7fa5d87
commit 175d57c126
2 changed files with 10 additions and 2 deletions

View file

@ -99,7 +99,13 @@ SourceDistribution::SourceDistribution(pugi::xml_node node)
}
if (check_for_node(node, "serialization")) {
serialization = get_node_value(node, "serialization", false, true);
// If the source is serialized then make sure we only load it from file once, otherwise there will
// be a significant I/O overhead.
pugi::xml_document doc;
doc.load_file(get_node_value(node, "serialization", false, true).c_str());
std::stringstream ss;
doc.print(ss);
serialization = ss.str();
}
} else {