From e03da1544985863fa3ef08244dcc629f1c632dbf Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sun, 23 Sep 2018 18:26:16 -0300 Subject: [PATCH] Move siblings to the top of the list when accessed --- Ryujinx.Graphics/ResourcePool.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Ryujinx.Graphics/ResourcePool.cs b/Ryujinx.Graphics/ResourcePool.cs index 0eb306eaee..44e475b67a 100644 --- a/Ryujinx.Graphics/ResourcePool.cs +++ b/Ryujinx.Graphics/ResourcePool.cs @@ -121,11 +121,16 @@ namespace Ryujinx.Graphics private LinkedList GetOrAddEntry(TKey Params) { - foreach ((TKey MyParams, LinkedList Resources) in Entries) + foreach ((TKey MyParams, LinkedList Resources) Tuple in Entries) { - if (MyParams.IsCompatible(Params)) + if (Tuple.MyParams.IsCompatible(Params)) { - return Resources; + //Move accessed siblings to the top of the list, for faster access in the future + Entries.Remove(Tuple); + + Entries.AddFirst(Tuple); + + return Tuple.Resources; } }