Skip to content

Fix object alignment for double-word boundaries (Issue #57) #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 17, 2025

Conversation

gmorpheme
Copy link
Member

Summary

  • Implement proper double-word (16-byte) alignment for all heap allocations
  • Add comprehensive test coverage for alignment validation
  • Update fragmentation tests to account for alignment impact

Performance Impact

  • Benchmarks show ~8% regression in allocation performance due to increased memory usage
  • This trade-off provides better cache alignment and prepares for future SIMD optimizations
  • Memory usage increased due to alignment padding but improves access patterns

Test Coverage

  • Added test_alloc_size_calculation() to verify alignment calculation
  • Added test_allocation_alignment() to verify runtime alignment
  • Added test_header_alignment() to verify header positioning
  • Updated fragmentation strategy test to handle alignment impact

🤖 Generated with Claude Code

gmorpheme and others added 2 commits June 17, 2025 17:25
This commit implements Issue #57: Object alignment fixes by updating
the memory allocator to ensure all objects are aligned to 16-byte
boundaries for improved performance on modern architectures.

Key changes:
- Updated alloc_size_of() to align total allocation size to 16 bytes
- Since AllocHeader is exactly 16 bytes, objects are naturally aligned
- Added comprehensive alignment test coverage
- Fixed fragmentation test expectations for alignment impact
- Updated .gitignore to properly exclude GC test results

Performance impact: ~8% regression in allocation benchmarks due to
increased memory usage, but provides better cache alignment and
prepares for future SIMD optimizations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@gmorpheme gmorpheme merged commit 59983ac into master Jun 17, 2025
16 checks passed
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