From b122efb64c4e32072ade98eae727c1bf6493dd94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Mon, 20 Feb 2023 17:06:59 +0900 Subject: [PATCH] Tiny speedup to HasGenericVirtualMethods (#82383) This avoids materializing/resolving non-virtual methods. --- src/coreclr/tools/Common/Compiler/TypeExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/tools/Common/Compiler/TypeExtensions.cs b/src/coreclr/tools/Common/Compiler/TypeExtensions.cs index f50028f09c4af0..629544809b8542 100644 --- a/src/coreclr/tools/Common/Compiler/TypeExtensions.cs +++ b/src/coreclr/tools/Common/Compiler/TypeExtensions.cs @@ -100,9 +100,9 @@ public static bool IsArrayMethod(this MethodDesc method) /// public static bool HasGenericVirtualMethods(this TypeDesc type) { - foreach (var method in type.GetAllMethods()) + foreach (var method in type.GetAllVirtualMethods()) { - if (method.IsVirtual && method.HasInstantiation) + if (method.HasInstantiation) return true; }