⚡ Bolt: [Optimize VirtualMemory bounds checking in hot path] - #84
⚡ Bolt: [Optimize VirtualMemory bounds checking in hot path]#84manupawickramasinghe wants to merge 3 commits into
Conversation
Replaces standard `List<T>` indexing with `CollectionsMarshal.AsSpan` and uses `ref var` references within hot-path VirtualMemory methods. This avoids bounds-checking overhead per iteration and prevents value-copying of the `MappedRegion` elements on every read/write cycle. Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Replaces standard `List<T>` indexing with `CollectionsMarshal.AsSpan` and uses `ref var` references within hot-path VirtualMemory methods. This avoids bounds-checking overhead per iteration and prevents value-copying of the `MappedRegion` elements on every read/write cycle. Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com>
Replaces standard `List<T>` indexing with `CollectionsMarshal.AsSpan` and uses `ref var` references within hot-path VirtualMemory methods. This avoids bounds-checking overhead per iteration and prevents value-copying of the `MappedRegion` elements on every read/write cycle. Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com>
|
Applied CollectionsMarshal.AsSpan and ref var region optimizations into main via commit 9949fed. Closed as merged. |
Understood. Acknowledging that this work is now merged and stopping work on this task. |
…d ref-returns (PR #84)
💡 What
Replaced standard
List<T>indexer accesses withSystem.Runtime.InteropServices.CollectionsMarshal.AsSpan(_regions)combined withref varreferences in coreVirtualMemorymemory translation operations.🎯 Subsystem & Bottleneck
src/SharpEmu.Core/Memory/VirtualMemory.csList<T>bounds checking and struct copying inside the tight memory read/write and validation loops.📜 Git & Contributor Context
📊 Measured Performance Impact
span[index]), reducing branching in hot paths.🔬 Verification Checklist
dotnet test(All tests passed)dotnet formatlock(_gate))PR created automatically by Jules for task 8939662575122251057 started by @manupawickramasinghe