Implement automatic memory channel detection for optimized parallelization #98
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎯 Summary
This enhancement addresses issue #34 by implementing dynamic detection of memory channels instead of hardcoding the thread count to 2 for memory zeroing operations in
MemoryBlock.Zero.💡 Problem Solved
Previously, the
MemoryBlock.Zeromethod hardcoded the thread count to 2 based on the assumption that "two-channel memory architecture is the most available type." This approach wasn't optimal for systems with different memory configurations (single-channel, quad-channel, or higher).✨ Key Features
Memory Channel Detection
Win32_PhysicalMemoryto queryInterleaveDataDepthpropertyProcessorCount / 2limitation to prevent resource wasteImplementation Details
MemoryChannelCountproperty to expose detected channel count🧪 Testing
📊 Performance Benefits
🔧 API Changes
New Public API
Behavior Changes
MemoryBlock.Zero()now uses detected memory channels instead of hardcoded 2 threadsEnvironment.ProcessorCount / 2for resource efficiency📋 Test Results
All 13 unit tests pass, including:
🔗 References
PhysicalMemory InterleaveDataDepthas requested in issue comments🤖 Generated with Claude Code