experimental caching of memory array

This commit is contained in:
LotP1 2025-11-20 02:21:56 +01:00
parent caefa53949
commit 27620161c2

View File

@ -263,6 +263,9 @@ namespace Ryujinx.Cpu.Jit
} }
} }
//Might cause issues, if so revert to old solution
byte[] _cachedArray = [];
public override ReadOnlySpan<byte> GetSpan(ulong va, int size, bool tracked = false) public override ReadOnlySpan<byte> GetSpan(ulong va, int size, bool tracked = false)
{ {
if (size == 0) if (size == 0)
@ -281,7 +284,12 @@ namespace Ryujinx.Cpu.Jit
} }
else else
{ {
Span<byte> data = new byte[size]; if (_cachedArray.Length < size)
{
Array.Resize(ref _cachedArray, size);
}
Span<byte> data = _cachedArray.AsSpan(0, size);
Read(va, data); Read(va, data);