summaryrefslogtreecommitdiff
path: root/src/protocols/core/Compositor.cpp
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2024-10-28 19:02:52 +0100
committerGitHub <noreply@github.com>2024-10-28 18:02:52 +0000
commitc7315617eb6186912d03232e1968f32b88f153f2 (patch)
tree7e22a153c332378439c72ebf4bb06f6069411527 /src/protocols/core/Compositor.cpp
parentd49a1334a8af7c704626cdf1746cb72415ad6d0d (diff)
internal: few more marginal optimisations from profiling (#8271)
* deco: reduce local temporars and function calls profiling shows this is a high used function, reduce the amount of function calls and local temporar copies and also check if we even need to add extents at all in the loop. * popup: optimize bfhelper in popups pass nodes as const reference and reserve the size of the children node vector help reduce the reallocations. * procotol: make compositor bfhelper use const ref use const ref for nodes and reserve second nodes vector size to reduce amount of reallocation needed.
Diffstat (limited to 'src/protocols/core/Compositor.cpp')
-rw-r--r--src/protocols/core/Compositor.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp
index 9a2e00a9..d78d3d8b 100644
--- a/src/protocols/core/Compositor.cpp
+++ b/src/protocols/core/Compositor.cpp
@@ -252,9 +252,10 @@ void CWLSurfaceResource::resetRole() {
role = makeShared<CDefaultSurfaceRole>();
}
-void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> nodes, std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data) {
+void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> const& nodes, std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data) {
std::vector<SP<CWLSurfaceResource>> nodes2;
+ nodes2.reserve(nodes.size() * 2);
// first, gather all nodes below
for (auto const& n : nodes) {