rjx-mirror/Ryujinx.Memory
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
..
Range Memory: Faster Split for NonOverlappingRangeList (#4451) 2023-02-21 10:53:38 +01:00
Tracking Clear CPU side data on GPU buffer clears (#4125) 2023-02-16 18:28:49 -03:00
WindowsShared Replace DllImport usage with LibraryImport (#4084) 2022-12-15 18:07:31 +01:00
AddressSpaceManager.cs Clear CPU side data on GPU buffer clears (#4125) 2023-02-16 18:28:49 -03:00
InvalidAccessHandler.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
InvalidMemoryRegionException.cs Update InvalidMemoryRegionException.cs to abide by English rules. (#1834) 2020-12-25 04:09:02 +01:00
IRefCounted.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
IVirtualMemoryManager.cs Clear CPU side data on GPU buffer clears (#4125) 2023-02-16 18:28:49 -03:00
IWritableBlock.cs Return mapped buffer pointer directly for flush, WriteableRegion for textures (#2494) 2021-07-19 19:10:54 -03:00
MemoryAllocationFlags.cs Implement JIT Arm64 backend (#4114) 2023-01-10 19:16:59 -03:00
MemoryBlock.cs Implement support for page sizes > 4KB (#4252) 2023-01-17 05:13:24 +01:00
MemoryConstants.cs Implement a new physical memory manager and replace DeviceMemory (#856) 2020-05-04 08:54:50 +10:00
MemoryManagement.cs Implement JIT Arm64 backend (#4114) 2023-01-10 19:16:59 -03:00
MemoryManagementUnix.cs Implement JIT Arm64 backend (#4114) 2023-01-10 19:16:59 -03:00
MemoryManagementWindows.cs Move partial unmap handler to the native signal handler (#3437) 2022-07-29 19:16:29 -03:00
MemoryManagerUnixHelper.cs Implement JIT Arm64 backend (#4114) 2023-01-10 19:16:59 -03:00
MemoryMapFlags.cs Implement support for page sizes > 4KB (#4252) 2023-01-17 05:13:24 +01:00
MemoryNotContiguousException.cs IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel (#1458) 2020-12-02 00:23:43 +01:00
MemoryPermission.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
MemoryProtectionException.cs Implement a new physical memory manager and replace DeviceMemory (#856) 2020-05-04 08:54:50 +10:00
NativeMemoryManager.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
PageTable.cs Support memory aliasing (#2954) 2022-05-02 20:30:02 -03:00
Ryujinx.Memory.csproj infra: Migrate to .NET 7 (#3795) 2022-11-09 20:22:43 +01:00
WritableRegion.cs Return mapped buffer pointer directly for flush, WriteableRegion for textures (#2494) 2021-07-19 19:10:54 -03:00