Skip to content

feat: move next frame and next world update into managed side#1155

Merged
roflmuffin merged 1 commit intomainfrom
perf/next-frame
Dec 18, 2025
Merged

feat: move next frame and next world update into managed side#1155
roflmuffin merged 1 commit intomainfrom
perf/next-frame

Conversation

@roflmuffin
Copy link
Copy Markdown
Owner

@roflmuffin roflmuffin commented Dec 18, 2025

Move NextFrame queue to managed .NET side

During extensive testing of NextFrame and related scheduling code, I benchmarked using a .NET ConcurrentQueue<T> instead of the current C++ concurrent queue implementation.

Results

  • Native C++ approach: Queuing and resolving 100,000 NextFrame tasks took ~300ms on average (mainly due to P/Invoke overhead & FunctionReference memory allocations)
  • Managed .NET approach: The same workload completed in 5–20ms (variance depends on where in the frame the benchmark was queued)

This is roughly a 50x improvement by moving the queue storage to the .NET side and having a managed listener drain the queue each frame.

@roflmuffin roflmuffin merged commit 5895683 into main Dec 18, 2025
8 checks passed
@roflmuffin roflmuffin deleted the perf/next-frame branch December 18, 2025 07:11
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.

1 participant