Vulkan: HashTableSlim lookup optimization (#4688)
This commit is contained in:
parent
3e68a87d63
commit
138d5dc64a
@ -15,6 +15,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
private struct Entry
|
private struct Entry
|
||||||
{
|
{
|
||||||
|
public int Hash;
|
||||||
public K Key;
|
public K Key;
|
||||||
public V Value;
|
public V Value;
|
||||||
}
|
}
|
||||||
@ -59,6 +60,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
{
|
{
|
||||||
var entry = new Entry()
|
var entry = new Entry()
|
||||||
{
|
{
|
||||||
|
Hash = key.GetHashCode(),
|
||||||
Key = key,
|
Key = key,
|
||||||
Value = value
|
Value = value
|
||||||
};
|
};
|
||||||
@ -91,12 +93,11 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
var bucket = _hashTable[hashCode & TotalBucketsMask];
|
var bucket = _hashTable[hashCode & TotalBucketsMask];
|
||||||
if (bucket != null)
|
if (bucket != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < bucket.Length; i++)
|
for (int i = 0; i < bucket.Length; i++)
|
||||||
{
|
{
|
||||||
ref var entry = ref bucket[i];
|
ref var entry = ref bucket[i];
|
||||||
|
|
||||||
if (entry.Key.Equals(ref key))
|
if (entry.Hash == hashCode && entry.Key.Equals(ref key))
|
||||||
{
|
{
|
||||||
value = entry.Value;
|
value = entry.Value;
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user