Skip to content

⚡ Bolt: Optimize VulkanVideoPresenter allocations - #14

Merged
manupawickramasinghe merged 1 commit into
mainfrom
jules-vulkan-video-presenter-perf-11626771837109629001
Jul 25, 2026
Merged

⚡ Bolt: Optimize VulkanVideoPresenter allocations#14
manupawickramasinghe merged 1 commit into
mainfrom
jules-vulkan-video-presenter-perf-11626771837109629001

Conversation

@manupawickramasinghe

Copy link
Copy Markdown
Member

💡 What

Removed unnecessary .ToArray() calls on textures, globalMemoryBuffers, vertexBuffers, and targets collections in SubmitTranslatedDraw and related offscreen passes.

🎯 Subsystem & Bottleneck

  • Subsystem: Graphics (Vulkan/MoltenVK)
  • Target File(s): src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.cs
  • Bottleneck Addressed: High-frequency per-draw GC pressure caused by duplicating input IReadOnlyList<T> parameters into arrays (T[]) when instantiating VulkanTranslatedGuestDraw and VulkanOffscreenGuestDraw, which already natively accept IReadOnlyList<T>.

📜 Git & Contributor Context

  • Recent File History: Last modified outside the 7-day exclusion window; verified git log and git blame.
  • Conflict Check: Verified change does not overlap with recent commits or reverted attempts. The change avoids struct modifications and cleanly utilizes existing constructor signatures.

📊 Measured Performance Impact

  • Allocation Delta: Eliminated multiple array allocations (24+ bytes per array) per guest draw dispatch, yielding zero allocation on these parameters.
  • Computational Impact: Replaced O(N) collection copy (where N is resource count) with an O(1) reference assignment per draw.

🔬 Verification Checklist

  • Executed dotnet test (All tests passed)
  • Verified zero unexpected allocations in hot path
  • Verified formatting with dotnet format
  • Confirmed thread safety and emulation accuracy

PR created automatically by Jules for task 11626771837109629001 started by @manupawickramasinghe

Eliminate `.ToArray()` heap allocations on the `textures`, `globalMemoryBuffers`, `vertexBuffers`, and `targets` variables in `SubmitTranslatedDraw` and related offscreen passes, removing unnecessary allocation overhead in the core graphics dispatch hot path.

Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings July 24, 2026 20:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants