From f44421b7a76551415e12915599387c862f7ecbb2 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 26 Oct 2023 11:25:30 +0200 Subject: [PATCH] Optimize managed method invoke on NetCore to skip virtual call that is the same as default one --- Source/Engine/Scripting/BinaryModule.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Engine/Scripting/BinaryModule.cpp b/Source/Engine/Scripting/BinaryModule.cpp index efd147917..679ead4e3 100644 --- a/Source/Engine/Scripting/BinaryModule.cpp +++ b/Source/Engine/Scripting/BinaryModule.cpp @@ -1270,7 +1270,11 @@ bool ManagedBinaryModule::InvokeMethod(void* method, const Variant& instance, Sp // Invoke the method MObject* exception = nullptr; +#if USE_NETCORE // NetCore uses the same path for both virtual and non-virtual calls + MObject* resultObject = mMethod->Invoke(mInstance, params, &exception); +#else MObject* resultObject = withInterfaces ? mMethod->InvokeVirtual((MObject*)mInstance, params, &exception) : mMethod->Invoke(mInstance, params, &exception); +#endif if (exception) { MException ex(exception);