diff options
author | riperiperi <rhy3756547@hotmail.com> | 2022-12-21 01:28:18 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-21 02:28:18 +0100 |
commit | c200a7b7c668acc733a0c20df865662b86859746 (patch) | |
tree | ab8e85a54ae8b41a9ae05487668f04ec43ce49e8 | |
parent | 6268170a104740ee0d9d99e9ca88c96e1b52ef4b (diff) |
ARMeilleure: Hash _data pointer instead of value for Operand (#4156)1.1.482
I noticed a weirdly high cost for dictionary accesses from MarkLabel etc. Turns out that the hash code was always the same for labels, so the whole point of having a dictionary was missed and it was putting everything in the same bucket. I made it always hash the _data pointer as that's a good source of identifiable and "random" data.
-rw-r--r-- | ARMeilleure/IntermediateRepresentation/Operand.cs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/ARMeilleure/IntermediateRepresentation/Operand.cs b/ARMeilleure/IntermediateRepresentation/Operand.cs index b3aafa7a..896d3420 100644 --- a/ARMeilleure/IntermediateRepresentation/Operand.cs +++ b/ARMeilleure/IntermediateRepresentation/Operand.cs @@ -378,14 +378,7 @@ namespace ARMeilleure.IntermediateRepresentation public override int GetHashCode() { - if (Kind == OperandKind.LocalVariable) - { - return base.GetHashCode(); - } - else - { - return (int)Value ^ ((int)Kind << 16) ^ ((int)Type << 20); - } + return ((ulong)_data).GetHashCode(); } public bool Equals(Operand operand) |