From 8ef6127b701db08d40bb3fded5024d2fca0f563e Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Wed, 8 Oct 2025 13:00:38 +0200 Subject: [PATCH] Nodes: minor speedup for usage inferencing This reduces some overhead for group input nodes where many sockets are not used. This helps a bit with resolving the performance regression in #146949. Pull Request: https://projects.blender.org/blender/blender/pulls/147610 --- source/blender/nodes/intern/socket_usage_inference.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/blender/nodes/intern/socket_usage_inference.cc b/source/blender/nodes/intern/socket_usage_inference.cc index 15d101940b6..8382e43febf 100644 --- a/source/blender/nodes/intern/socket_usage_inference.cc +++ b/source/blender/nodes/intern/socket_usage_inference.cc @@ -105,8 +105,12 @@ class SocketUsageInferencerImpl { bool is_group_input_used(const int input_i) { for (const bNode *node : root_tree_.group_input_nodes()) { - const SocketInContext socket{nullptr, &node->output_socket(input_i)}; - if (this->is_socket_used(socket)) { + const bNodeSocket &socket = node->output_socket(input_i); + if (!socket.is_directly_linked()) { + continue; + } + const SocketInContext socket_ctx{nullptr, &socket}; + if (this->is_socket_used(socket_ctx)) { return true; } }