Commit c74adfec authored by Jason Rhinelander's avatar Jason Rhinelander

Small bundle print optimization

Using a `std::set` to sort is typically less efficient than building a
vector then sorting it (once).
parent 4d881c7e
......@@ -6,7 +6,7 @@
#include <algorithm>
#include <limits>
#include <unordered_set>
#include <set>
#include <vector>
#include <cmath>
namespace eris {
......@@ -527,12 +527,14 @@ void BundleSigned::_print(std::ostream &os) const {
os << "(";
// Sort the keys:
std::set<id_t> keys;
std::vector<id_t> keys;
keys.reserve(size());
for (auto &g : *this)
keys.insert(g.first);
keys.push_back(g.first);
std::sort(keys.begin(), keys.end());
bool first = true;
for (auto &k : keys) {
for (auto k : keys) {
if (!first) os << ", ";
else first = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment