Make ReadByteRange use a wrapper class instead of copying the entire thing into a new byte array #2927
Labels
App: EmuHawk
Relating to EmuHawk frontend
Enhancement
For feature requests or possible improvements
Meta
Relating to code organisation or to things that aren't code
re: APIHawk
Relating to EmuHawk's public .NET API or to the creation of external tools
Current code:
BizHawk/src/BizHawk.Client.Common/Api/Classes/MemoryApi.cs
Lines 246 to 256 in 3ea71a2
when a readbyterange is used every frame for large amounts, this can greatly reduce performance (60fps to 2fps). This is partially due to the memory allocation every frame, but also because all the data is copied over. It would likely be more efficient to read them when they are accessed. This has the drawback of not accounting for bytes written to that range since reading, so maybe add a nullable parameter to specify whether to lazy-load the range.
The reason for this request is that I often have to access memory quite often in a single frame, resulting in a ~20fps decrease just from all the memory.read_XXX calls, and having it available faster would be nice.
The text was updated successfully, but these errors were encountered: