From 279505d8b06e4f9f8f9c11309439c9892bcc710d Mon Sep 17 00:00:00 2001 From: Lukas Tenbrink Date: Sun, 16 Feb 2025 20:52:09 +0100 Subject: [PATCH] Optimize `GDScriptLambdaCallable` by skipping the unnecessary `ObjectDB` lookup for `script`. --- modules/gdscript/gdscript_lambda_callable.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/gdscript/gdscript_lambda_callable.cpp b/modules/gdscript/gdscript_lambda_callable.cpp index d767324b428..762d69ff362 100644 --- a/modules/gdscript/gdscript_lambda_callable.cpp +++ b/modules/gdscript/gdscript_lambda_callable.cpp @@ -45,7 +45,9 @@ bool GDScriptLambdaCallable::compare_less(const CallableCustom *p_a, const Calla } bool GDScriptLambdaCallable::is_valid() const { - return CallableCustom::is_valid() && function != nullptr; + // Don't need to call CallableCustom::is_valid(): + // It just verifies our script exists, which we know to be true because it is RefCounted. + return function != nullptr; } uint32_t GDScriptLambdaCallable::hash() const {