JinxRyu/Ryujinx.Memory/Range
riperiperi fc43aecbbd
Memory: Faster Split for NonOverlappingRangeList (#4451)
I noticed that in Xenoblade 2, the game can end up spending a lot of time adding and removing tracking handles. One of the main causes of this is actually splitting existing handles, which does the following:

- Remove existing handle from list
- Update existing handle to end at split address, create new handle starting at split address
- Add updated handle (left) to list
- Add new handle (right) to list

This costs 1 deletion and 2 insertions. When there are more handles, this gets a lot more expensive, as insertions are done by copying all values to the right, and deletions by copying values to the left.

This PR simply allows it to look up the handle being split, and replace its entry with the new end address without insertion or deletion. This makes a split only cost one insertion and a binary search lookup (very cheap). This isn't all of the cost on Xenoblade 2, but it does significantly reduce it.

There might be something else to this - we could find a way to reduce the handle count for the game (merging on deletion? buffer deletion?), we could use a different structure for virtual regions, as the current one is optimal for buffer lookups which nearly always read, memory tracking has more of a balance between read/write. That's for a later date though, this was an easy improvment.
2023-02-21 10:53:38 +01:00
..
HostMemoryRange.cs Implement support for page sizes > 4KB (#4252) 2023-01-17 05:13:24 +01:00
IMultiRangeItem.cs Support for resources on non-contiguous GPU memory regions (#1905) 2021-01-17 19:44:34 +01:00
INonOverlappingRange.cs Memory Read/Write Tracking using Region Handles (#1272) 2020-10-16 17:18:35 -03:00
IRange.cs Memory Read/Write Tracking using Region Handles (#1272) 2020-10-16 17:18:35 -03:00
MemoryRange.cs Make structs readonly when applicable (#4002) 2022-12-05 14:47:39 +01:00
MultiRange.cs Make structs readonly when applicable (#4002) 2022-12-05 14:47:39 +01:00
MultiRangeList.cs Allow textures to have their data partially mapped (#2629) 2022-02-22 13:34:16 -03:00
NonOverlappingRangeList.cs Memory: Faster Split for NonOverlappingRangeList (#4451) 2023-02-21 10:53:38 +01:00
RangeList.cs Memory: Faster Split for NonOverlappingRangeList (#4451) 2023-02-21 10:53:38 +01:00