Skip to content

Conversation

@naftaly
Copy link
Owner

@naftaly naftaly commented Dec 27, 2025

  • Add new workflow that runs tests with all three sanitizers (thread, address, undefined)
  • Sanitizers run in parallel on PRs to catch data races, memory issues, and undefined behavior
  • Uses Swift 6.0 matching the benchmarks workflow

Run tests with thread, address, and undefined behavior sanitizers
in parallel on PRs to catch data races, memory issues, and UB.
@github-actions
Copy link

github-actions bot commented Dec 27, 2025

🚀 MemoryMap Performance Benchmarks

256-entry capacity with double hashing, @inline(__always) optimizations

Test Hardware: Apple M1 (Virtual), 7 GB RAM

Core Operations

Operation Time Per-Op Main Thread
Contains 1.0ms 10.0 μs ✅ Excellent
Insert 1.0ms 10.0 μs ✅ Excellent
Lookup (hit) 6.0ms 60.0 μs ✅ Excellent
Lookup (miss) 4.0ms 40.0 μs ✅ Excellent
Mixed operations 5.0ms 25.0 μs ✅ Excellent
Remove (insert+delete) 6.0ms 30.0 μs ✅ Excellent
Update 3.0ms 30.0 μs ✅ Excellent

Load Factor Performance

Load % Lookups Time Per-Lookup Status
25% 6,400 119ms 18.6 μs ✅ Good
50% 12,800 253ms 19.8 μs ✅ Good
75% 19,200 381ms 19.8 μs ✅ Good
90% 23,000 441ms 19.2 μs ✅ Good
99% 25,300 475ms 18.8 μs ✅ Good

Key Length Impact (100 ops)

Key Length Time Per-Op
Long (64 chars) 7.0ms 70.0 μs
Medium (~25 chars) 2.0ms 20.0 μs
Short (2-3 chars) 2.0ms 20.0 μs

Bulk Operations

Operation Time Description
Count (100 entries) 4.0ms ✅ Excellent
Keys iteration (100 entries) 0.0ms ✅ Excellent
Large batch write 2.0ms ✅ Excellent
Remove all entries 2.0ms ✅ Excellent
Convert to Dictionary (100 entries) 1.0ms ✅ Excellent

Stress & Edge Cases

Test Time Status
Many tombstones 5ms ✅ Good
Random access pattern 6ms ✅ Good
Sequential vs random access 5ms ✅ Good
Worst-case probe chain 74ms ⚠️ OK

Persistence

Operation Time Status
Write, close, reopen 3ms ✅ Excellent

Performance Characteristics

Main Thread Budget

  • Excellent: <10ms - Perfect for UI interactions
  • Good: 10-50ms - Acceptable for most operations
  • ⚠️ OK: 50-100ms - Use with caution on main thread
  • Review: >100ms - Consider background thread

Target: 16.67ms/frame @ 60fps, 8.33ms/frame @ 120fps

Capacity & Optimization

  • Fixed capacity: 256 entries
  • Recommended usage: ≤200 keys for optimal performance
  • Memory footprint: ~306KB per store
  • Key optimizations: Double hashing, @inline(__always), direct buffer access via withUnsafeBytes

Total tests: 25 passed | Generated 2025-12-27 21:48:48

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new GitHub Actions workflow to automatically run Swift tests with sanitizers on pull requests. The workflow runs three sanitizers (thread, address, and undefined behavior) in parallel to catch data races, memory issues, and undefined behavior early in the development cycle.

  • Adds sanitizer testing infrastructure that runs on all PRs
  • Uses Swift 6.0 to match the existing benchmarks workflow
  • Implements parallel execution with fail-fast disabled to ensure all sanitizers run

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@naftaly naftaly marked this pull request as ready for review December 27, 2025 21:50
@naftaly naftaly merged commit c4fd304 into main Dec 27, 2025
9 checks passed
@naftaly naftaly deleted the add-sanitizer-workflow branch December 27, 2025 21:59
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