From 6c96712bfbb10e06816b0835f6c28b157e0d6023 Mon Sep 17 00:00:00 2001 From: Andy Adshead Date: Fri, 26 Apr 2019 01:10:11 +0100 Subject: [PATCH] Uses iequatable over override equals to avoid conversion and checks at runtime --- Ryujinx.Profiler/ProfileConfig.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Ryujinx.Profiler/ProfileConfig.cs b/Ryujinx.Profiler/ProfileConfig.cs index dac1593be3..6a2b2bc084 100644 --- a/Ryujinx.Profiler/ProfileConfig.cs +++ b/Ryujinx.Profiler/ProfileConfig.cs @@ -1,10 +1,8 @@ using System; -using System.Collections.Generic; -using System.Text; namespace Ryujinx.Profiler { - public struct ProfileConfig + public struct ProfileConfig : IEquatable { public string Category; public string SessionGroup; @@ -71,18 +69,12 @@ namespace Ryujinx.Profiler } /// - /// This equals overload is vital /// The default comparison is far too slow for the number of comparisons needed because it doesn't know what's important to compare /// /// Object to compare to /// - public override bool Equals(object obj) + public bool Equals(ProfileConfig cmpObj) { - if (!(obj is ProfileConfig)) - return false; - - ProfileConfig cmpObj = (ProfileConfig)obj; - // Order here is important. // Multiple entries with the same item is considerable less likely that multiple items with the same group. // Likewise for group and category.