Ryujinx/Ryujinx.Common/Memory
jhorv 666e05f5cb
Reducing Memory Allocations 202303 (#4624)
* use ArrayPool, avoid 6000-7000 allocs/sec of runtime

* use ArrayPool, avoid ~7k allocs/second during game execution

* use ArrayPool, avoid ~3000 allocs/sec during game execution

* use MemoryPool, reduce 0.5 MB/sec of new allocations during game execution

* avoid over-allocation by setting List<> Capacity when known

* remove LINQ in KTimeManager.UnscheduleFutureInvocation

* KTimeManager - avoid spinning one more time when the time has arrived

* KTimeManager - let SpinWait decide when to Thread.Yield(), and don't SpinOnce() immediately after Thread.Yield()

* use MemoryPool, reduce ~175k bytes/sec allocation during game execution

* IpcService - call commands via dynamic methods instead of reflection .Invoke(). Faster to call and with fewer allocations because parameters can be passed directly instead of as an array

* Make ButtonMappingEntry a record struct to avoid allocations. Set the List<ButtonMappingEntry> capacity according to use.

* add MemoryBuffer type for working with MemoryPool<byte>

* update changes to use MemoryBuffer

* make parameter ReadOnlySpan instead of Span

* whitespace fix

* Revert "IpcService - call commands via dynamic methods instead of reflection .Invoke(). Faster to call and with fewer allocations because parameters can be passed directly instead of as an array"

This reverts commit f2c698bdf65f049e8481c9f2ec7138d9b9a8261d.

* tweak KTimeManager spin behavior

* replace MemoryBuffer with ByteMemoryPool modeled after System.Buffers.ArrayMemoryPool<T>

* make ByteMemoryPoolBuffer responsible for renting memory
2023-04-24 02:06:23 +00:00
..
PartialUnmaps chore: Update tests dependencies (#3978) 2023-01-01 17:35:29 +01:00
ArrayPtr.cs Rename ToSpan to AsSpan (#3556) 2022-08-11 18:07:37 -03:00
Box.cs time: Make TimeZoneRule blittable and avoid copies (#3361) 2022-06-24 19:04:57 +02:00
ByteMemoryPool.ByteMemoryPoolBuffer.cs Reducing Memory Allocations 202303 (#4624) 2023-04-24 02:06:23 +00:00
ByteMemoryPool.cs Reducing Memory Allocations 202303 (#4624) 2023-04-24 02:06:23 +00:00
IArray.cs New NVDEC and VIC implementation (#1384) 2020-07-12 05:07:01 +02:00
MemoryStreamManager.cs Reducing memory allocations (#4537) 2023-03-17 13:14:50 +01:00
Ptr.cs New NVDEC and VIC implementation (#1384) 2020-07-12 05:07:01 +02:00
SpanOrArray.cs Make structs readonly when applicable (#4002) 2022-12-05 14:47:39 +01:00
SpanReader.cs Avoid LM service crashes by not reading more than the buffer size (#4701) 2023-04-20 17:10:17 +02:00
SpanWriter.cs IPC refactor part 3+4: New server HIPC message processor (#4188) 2023-01-04 23:15:45 +01:00
StructArrayHelpers.cs Rename ToSpan to AsSpan (#3556) 2022-08-11 18:07:37 -03:00
StructByteArrayHelpers.cs Rename ToSpan to AsSpan (#3556) 2022-08-11 18:07:37 -03:00