mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-10 04:31:46 +00:00
fc43aecbbd
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. |
||
---|---|---|
.. | ||
Range | ||
Tracking | ||
WindowsShared | ||
AddressSpaceManager.cs | ||
InvalidAccessHandler.cs | ||
InvalidMemoryRegionException.cs | ||
IRefCounted.cs | ||
IVirtualMemoryManager.cs | ||
IWritableBlock.cs | ||
MemoryAllocationFlags.cs | ||
MemoryBlock.cs | ||
MemoryConstants.cs | ||
MemoryManagement.cs | ||
MemoryManagementUnix.cs | ||
MemoryManagementWindows.cs | ||
MemoryManagerUnixHelper.cs | ||
MemoryMapFlags.cs | ||
MemoryNotContiguousException.cs | ||
MemoryPermission.cs | ||
MemoryProtectionException.cs | ||
NativeMemoryManager.cs | ||
PageTable.cs | ||
Ryujinx.Memory.csproj | ||
WritableRegion.cs |