C++17's std::map allows us to merge two maps, and in this case, we can
even consume `child_result`. so map::merge() is used instead of insert()
in hope to avoid the memcpy and allocation of pair<> nodes.
Signed-off-by: Kefu Chai <kchai@redhat.com>
if (child_result.size() && start) {
assert(child_result.begin()->first > *start);
}
- result.insert(
- child_result.begin(),
- child_result.end());
- biter++;
+ result.merge(std::move(child_result));
+ ++biter;
assert(child_complete || result.size() == config.max_result_size);
return list_ertr::make_ready_future<bool>(false);
});