mirror of
https://github.com/grin-compiler/grin.git
synced 2024-08-16 17:30:24 +03:00
revert: faster serialization
This commit is contained in:
parent
4711ce0710
commit
6477c2e271
@ -37,18 +37,9 @@ void emit_node_set(std::ofstream& f, node_set_t& ns) {
|
|||||||
emit_int32_t(f, RES_NODE_SET);
|
emit_int32_t(f, RES_NODE_SET);
|
||||||
emit_int32_t(f, ns.size());
|
emit_int32_t(f, ns.size());
|
||||||
|
|
||||||
// get sorted key vector
|
for (auto& i: ns) {
|
||||||
std::vector<int32_t> keys;
|
emit_int32_t(f, i.first);
|
||||||
keys.reserve (ns.size());
|
emit_node_item(f, i.second);
|
||||||
for (auto& it : ns) {
|
|
||||||
keys.push_back(it.first);
|
|
||||||
}
|
|
||||||
std::sort (keys.begin(), keys.end());
|
|
||||||
|
|
||||||
// save items in sorted key order
|
|
||||||
for (auto& i: keys) {
|
|
||||||
emit_int32_t(f, i);
|
|
||||||
emit_node_item(f, ns[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user