## Changes ### 1. core/page_arena.c - Removed init failure message (lines 25-27) - error is handled by returning early - All other fprintf statements already wrapped in existing #if !HAKMEM_BUILD_RELEASE blocks ### 2. core/hakmem.c - Wrapped SIGSEGV handler init message (line 72) - CRITICAL: Kept SIGSEGV/SIGBUS/SIGABRT error messages (lines 62-64) - production needs crash logs ### 3. core/hakmem_shared_pool.c - Wrapped all debug fprintf statements in #if !HAKMEM_BUILD_RELEASE: - Node pool exhaustion warning (line 252) - SP_META_CAPACITY_ERROR warning (line 421) - SP_FIX_GEOMETRY debug logging (line 745) - SP_ACQUIRE_STAGE0.5_EMPTY debug logging (line 865) - SP_ACQUIRE_STAGE0_L0 debug logging (line 803) - SP_ACQUIRE_STAGE1_LOCKFREE debug logging (line 922) - SP_ACQUIRE_STAGE2_LOCKFREE debug logging (line 996) - SP_ACQUIRE_STAGE3 debug logging (line 1116) - SP_SLOT_RELEASE debug logging (line 1245) - SP_SLOT_FREELIST_LOCKFREE debug logging (line 1305) - SP_SLOT_COMPLETELY_EMPTY debug logging (line 1316) - Fixed lock_stats_init() for release builds (lines 60-65) - ensure g_lock_stats_enabled is initialized ## Performance Validation Before: 51M ops/s (with debug fprintf overhead) After: 49.1M ops/s (consistent performance, fprintf removed from hot paths) ## Build & Test ```bash ./build.sh larson_hakmem ./out/release/larson_hakmem 1 5 1 1000 100 10000 42 # Result: 49.1M ops/s ``` Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
4.8 KiB
4.8 KiB
Repository Cleanup Summary - 2025-11-01
Overview
Comprehensive cleanup of hakmem repository following Mid MT implementation completion.
Statistics
Before Cleanup:
- Root directory: 252 files
- Documentation (.md/.txt): 124 files
- Scripts: 38 shell scripts
- Build artifacts: 46 .o files + executables
- Temporary files: ~12 tmp_* files
- External sources: glibc-2.38 (238MB)
After Cleanup:
- Root directory: 95 files (~62% reduction)
- Documentation (.md): 6 core files
- Scripts: 29 active scripts (9 archived)
- Build artifacts: Cleaned (via make clean)
- Temporary files: All removed
- External sources: Removed (can re-download)
Archive Structure Created
archive/
├── phase2/ (5 files) - Phase 2 documentation
├── analysis/ (15 files) - Historical analysis reports
├── old_benches/ (13 files) - Old benchmark results
├── old_logs/ (29 files) - Debug/test logs
└── experimental_scripts/ (9 files) - AB tests, sweep scripts
Files Moved
Phase 2 Documentation → archive/phase2/
- IMPLEMENTATION_ROADMAP.md
- P0_SUCCESS_REPORT.md
- README_PHASE_2C.txt
- PHASE2_MODULE6_*.txt
Historical Analysis → archive/analysis/
- RING_SIZE_* (4 files)
- 3LAYER_* (2 files)
- COMPARISON (2 files)
- BOTTLENECK_COMPARISON.txt
- DEPENDENCY_GRAPH.txt
- MT_SAFETY_FINDINGS.txt
- NEXT_STEP_ANALYSIS.md
- QUESTION_FOR_CHATGPT_PRO.md
- gemini_*.txt (4 files)
Old Benchmarks → archive/old_benches/
- bench_phase*.txt (3 files)
- bench_step*.txt (4 files)
- bench_reserve*.txt (2 files)
- bench_hakmem_default_results.txt
- bench_mimalloc_results.txt
- bench_getenv_fix_results.txt
Benchmark Logs → bench_results/
- bench_burst_*.log (3 files)
- bench_frag_*.log (3 files)
- bench_random_*.log (4 files)
- bench_3layer*.txt (2 files)
- bench_*_final.txt (2 files)
- bench_mid_large*.log (6 files - recent Mid MT benchmarks)
- larson_*.log (2 files)
Performance Data → perf_data/
- perf_*.txt (15 files)
- perf_*.log (11 files)
- perf_*.data (2 files)
Debug Logs → archive/old_logs/
- debug_*.log (5 files)
- test_*.log (4 files)
- obs_*.log (7 files)
- build_pgo*.log (2 files)
- phase*.log (2 files)
- _dbg.log (4 files)
- Other debug artifacts (3 files)
Experimental Scripts → archive/experimental_scripts/
- ab_*.sh (4 files)
- sweep_*.sh (4 files)
- prof_sweep.sh
- reorg_plan_a.sh
Deleted Files
Temporary Files (12 files):
- .tmp_* (2 files)
- tmp_*.log (10 files)
Build Artifacts:
- *.o files (46 files) - via make clean
- Old executables - rebuilt via make
External Sources:
- glibc-2.38/ (238MB)
- glibc-2.38.tar.gz* (2 files)
Remaining Root Files (Core Only)
Documentation (6 files):
- README.md
- DOCS_INDEX.md
- ENV_VARS.md
- SOURCE_MAP.md
- QUICK_REFERENCE.md
- MID_MT_COMPLETION_REPORT.md (current work)
Source Files:
- Benchmark sources: bench_*.c (10 files)
- Test sources: test_*.c (28 files)
- Other .c files as needed
Build System:
- Makefile
- build_*.sh scripts
Active Scripts (29 scripts)
Benchmarking:
- scripts/run_mid_mt_bench.sh ⭐ Mid MT main benchmark
- scripts/compare_mid_mt_allocators.sh ⭐ Mid MT comparison
- scripts/run_bench_suite.sh
- scripts/bench_mode.sh
- scripts/bench_large_profiles.sh
Application Testing:
- scripts/run_apps_with_hakmem.sh
- scripts/run_apps_*.sh (various profiles)
Memory Efficiency:
- scripts/run_memory_efficiency*.sh
- scripts/measure_rss_tiny.sh
Utilities:
- scripts/kill_bench.sh
- scripts/head_to_head_large.sh
Directories
Core:
core/- HAKMEM implementationscripts/- Active scriptsdocs/- Documentation
Benchmarking:
bench_results/- Current & historical benchmark results (865 files)perf_data/- Performance profiling data (28 files)
Archive:
archive/- Historical documents and experimental work (71 files)
New Structure (Frontend/Backend Plan):
adapters/- Frontend adapters (1 file)engines/- Backend engines (1 file)include/- Public headers (1 file)
External:
mimalloc-bench/- Benchmark suite (submodule)
Impact
- Disk space saved: ~250MB (glibc sources + build artifacts)
- Repository clarity: 62% reduction in root files
- Organization: Historical work properly archived
- Active work: Mid MT benchmarks clearly identified
Notes
- All archived files are preserved and can be restored if needed
- Build artifacts can be regenerated with
make - External sources (glibc) can be re-downloaded if needed
- Recent Mid MT benchmark logs kept in
bench_results/for easy access
Next Steps
- Continue Mid MT optimization work
- Use
scripts/run_mid_mt_bench.shfor benchmarking - Refer to archived phase2/ docs for historical context
- Maintain clean root directory for new work