mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-17 21:13:48 -07:00
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.
This commit is contained in:
@@ -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) {
|
||||
|
@@ -147,7 +147,7 @@ class CWLSurfaceResource {
|
||||
void dropPendingBuffer();
|
||||
void dropCurrentBuffer();
|
||||
void commitPendingState();
|
||||
void bfHelper(std::vector<SP<CWLSurfaceResource>> nodes, std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data);
|
||||
void bfHelper(std::vector<SP<CWLSurfaceResource>> const& nodes, std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data);
|
||||
void updateCursorShm();
|
||||
|
||||
friend class CWLPointerResource;
|
||||
|
Reference in New Issue
Block a user