summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-04-15 16:45:01 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-04-15 16:45:01 +0000
commit8ba64bce5c621c31a719c3844c4d2aa6d5b0c3e1 (patch)
tree42d797a50aca3717e8045b8f745152f9fbca9e4b /vespalib
parentb584208e8b3f78ae7af4cbfe93d6b9c4056e46ed (diff)
Factor out sorting of children to avoid reserving stackspace in the recursive path.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/trace/tracenode.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/vespalib/src/vespa/vespalib/trace/tracenode.cpp b/vespalib/src/vespa/vespalib/trace/tracenode.cpp
index 12dd51ac677..02883eda808 100644
--- a/vespalib/src/vespa/vespalib/trace/tracenode.cpp
+++ b/vespalib/src/vespa/vespalib/trace/tracenode.cpp
@@ -37,6 +37,12 @@ struct Cmp {
}
};
+void sortChildren(std::vector<TraceNode> & children) __attribute((noinline));
+void
+sortChildren(std::vector<TraceNode> & children) {
+ std::sort(children.begin(), children.end(), Cmp());
+}
+
} // namespace <unnamed>
@@ -121,7 +127,7 @@ TraceNode::sort()
child.sort();
}
if (!isStrict()) {
- std::sort(_children.begin(), _children.end(), Cmp());
+ sortChildren(_children);
}
}
return *this;