Cache reflection calls when running utility lints and commands.

Reduces runtime of --check-yaml command to 70% of original.
This commit is contained in:
RoosterDragon
2023-03-28 19:04:14 +01:00
committed by Matthias Mailänder
parent 1a2aafa17c
commit 9dd4f938da
24 changed files with 116 additions and 87 deletions

View File

@@ -45,10 +45,10 @@ namespace OpenRA.Mods.Common.Lint
{
foreach (var traitInfo in actorInfo.Value.TraitInfos<TraitInfo>())
{
var fields = traitInfo.GetType().GetFields();
var fields = Utility.GetFields(traitInfo.GetType());
foreach (var field in fields)
{
var cursorReference = field.GetCustomAttributes<CursorReferenceAttribute>(true).FirstOrDefault();
var cursorReference = Utility.GetCustomAttributes<CursorReferenceAttribute>(field, true).FirstOrDefault();
if (cursorReference == null)
continue;