Repository navigation
feat(15): Zero-copy PDU infrastructure - #34
Conversation
…cketPipe Add high-performance network I/O primitives for DICOM PDU handling: - SlabMemoryPool: 4KB slab allocator avoiding LOH pressure - SocketPipe: PipeReader/PipeWriter wrapper with backpressure support Part of Phase 15 - Zero-copy PDU handling.
There was a problem hiding this comment.
Review by RecurseML
🔍 Review performed on c986ec5..d30c5d1
✨ No bugs found, your code is sparkling clean
✅ Files analyzed, no issues (4)
• src/SharpDicom/Network/Pipes/SlabMemoryPool.cs
• src/SharpDicom/Network/Pipes/SocketPipe.cs
• tests/SharpDicom.Tests/Network/Pipes/SlabMemoryPoolTests.cs
• tests/SharpDicom.Tests/Network/Pipes/SocketPipeTests.cs
There was a problem hiding this comment.
1 issue found across 4 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/SharpDicom/Network/Pipes/SocketPipe.cs">
<violation number="1" location="src/SharpDicom/Network/Pipes/SocketPipe.cs:196">
P1: Handle partial sends: Socket.SendAsync may send fewer bytes than requested, so a single call can drop data when you advance the pipe to buffer.End. Loop until the entire segment is sent.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
- Add 60s per-test timeout and 10min session timeout via runsettings - Add 15 minute job timeout to CI workflow - Reference runsettings in dotnet test commands
Socket.SendAsync may send fewer bytes than requested. Loop until the entire segment is sent to prevent data loss.
netstandard2.0 Socket.ReceiveAsync/SendAsync don't accept CancellationToken, so cancellation alone can't unblock them. Shutdown and close the socket to ensure background tasks complete.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #34 +/- ##
==========================================
- Coverage 74.66% 74.65% -0.01%
==========================================
Files 182 184 +2
Lines 13980 14114 +134
Branches 2611 2631 +20
==========================================
+ Hits 10438 10537 +99
- Misses 2777 2806 +29
- Partials 765 771 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Test plan
High-level PR Summary
This PR introduces zero-copy network I/O infrastructure for efficient PDU handling in DICOM network operations. It adds a custom
SlabMemoryPoolfor managing fixed 4KB memory slabs that avoid Large Object Heap (LOH) pressure during high-throughput scenarios, and aSocketPipewrapper that integrates sockets with thePipeReader/PipeWriterpattern for zero-copy buffering with backpressure support. The implementation includes background read/write pumps for async socket operations, automatic memory pooling and reuse, and comprehensive test coverage with 20 tests validating concurrent access, bidirectional communication, large data handling, and proper resource cleanup.⏱️ Estimated Review Time: 30-90 minutes
💡 Review Order Suggestion
src/SharpDicom/Network/Pipes/SlabMemoryPool.cstests/SharpDicom.Tests/Network/Pipes/SlabMemoryPoolTests.cssrc/SharpDicom/Network/Pipes/SocketPipe.cstests/SharpDicom.Tests/Network/Pipes/SocketPipeTests.csSummary by cubic
Adds SlabMemoryPool and SocketPipe to enable zero-copy PDU network I/O with backpressure and pooled 4KB buffers. Meets Phase 15 requirements by reducing allocations and GC/LOH pressure while wiring sockets to PipeReader/PipeWriter.
New Features
Bug Fixes
Written for commit 1e3a839. Summary will update on new commits.