Files
hakmem/docs/analysis/ENV_CLEANUP_SUMMARY.md
Moe Charm (CI) 6fadc74405 ENV cleanup: Remove obsolete ULTRAHOT variable + organize docs
Changes:
1. Removed HAKMEM_TINY_FRONT_ENABLE_ULTRAHOT variable
   - Deleted front_prune_ultrahot_enabled() function
   - UltraHot feature was removed in commit bcfb4f6b5
   - Variable was dead code, no longer referenced

2. Organized ENV cleanup analysis documents
   - Moved 5 ENV analysis docs to docs/analysis/
   - ENV_CLEANUP_PLAN.md - detailed file-by-file plan
   - ENV_CLEANUP_SUMMARY.md - executive summary
   - ENV_CLEANUP_ANALYSIS.md - categorized analysis
   - ENV_CONSOLIDATION_PLAN.md - consolidation proposals
   - ENV_QUICK_REFERENCE.md - quick reference guide

Impact:
- ENV variables: 221 → 220 (-1)
- Build:  Successful
- Risk: Zero (dead code removal)

Next steps (documented in ENV_CLEANUP_SUMMARY.md):
- 21 variables need verification (Ultra/HeapV2/BG/HotMag)
- SFC_DEBUG deduplication opportunity (7 callsites)

File: core/box/front_metrics_box.h
Status: SAVEPOINT - stable baseline for future ENV cleanup

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 17:12:41 +09:00

93 lines
2.9 KiB
Markdown

# ENV Variable Cleanup Analysis - Executive Summary
## Key Findings
### Good News: Most "Obsolete" Features Already Cleaned! ✅
The major obsolete features (UltraHot, RingCache, FrontC23, Class5) were **already removed** in commits:
- bcfb4f6b5: "Remove dead code: UltraHot, RingCache, FrontC23, Class5 Hotpath"
- 225b6fcc7: Duplicate cleanup commit
- a9ddb52ad: "ENV cleanup: Remove BG/HotMag vars"
All 11 ENV variables for these features are **already gone from the codebase**
### Surprise Finding: SFC is ACTIVE (Not Obsolete!)
**SFC (Shared Frontend Cache)** was listed as "obsolete" but analysis shows:
- ✅ Compiled in all binaries (hakmem_tiny_sfc.o)
- ✅ Default: `g_sfc_enabled = 1` (ON by default)
- ✅ Active optimization with 6 ENV vars
- **Action**: KEEP all SFC vars
### Actual Cleanup Opportunities
**54 potentially obsolete vars** break down as:
- 11 vars: Already removed ✅
- 16 vars: Active features (SFC, TC, BigCache) - KEEP ✅
- 6 vars: Active L25 TLS ring - KEEP ✅
- **21 vars: Need verification** ⚠️
## Priority 1: Quick Wins (No Risk)
### SFC Debug Deduplication
**Problem**: `getenv("HAKMEM_SFC_DEBUG")` called 4x in different files
**Fix**: Single global variable, set once at init
**Savings**: -3 getenv() calls per debug check
**Risk**: Zero
**Files**: 4 files, ~8 lines total
## Priority 2: Verification Needed (21 vars)
| Feature | Vars | Status | Question |
|---------|------|--------|----------|
| Ultra features | 8 | Gated/experimental | Still needed? |
| Heap V2 | 7 | Unknown | Active or replaced? |
| BG System | 5 | Partially active | Keep or deprecate? |
| HotMag/SmallMag | 1 | File exists | Used or obsolete? |
## Priority 3: Deprecation Candidates
**IF verification confirms obsolete** (needs user input):
```
HAKMEM_TINY_FRONT_ENABLE_ULTRAHOT # UltraHot removed in bcfb4f6b5!
HAKMEM_TINY_ULTRA_* (if unused) # 8 vars
HAKMEM_TINY_HEAP_V2_* (if replaced) # 7 vars
HAKMEM_BATCH_BG (if deprecated) # 5 vars
```
**Total potential**: Up to 21 vars (after verification)
## Recommended Action Plan
### Immediate (This Week)
1. ✅ Deduplicate SFC_DEBUG (4 files, low risk)
2. ✅ Remove HAKMEM_TINY_FRONT_ENABLE_ULTRAHOT (UltraHot deleted!)
### Short Term (Next Sprint)
3. ⚠️ Verify Ultra features with maintainers
4. ⚠️ Verify Heap V2 status
5. ⚠️ Verify BG system usage
6. ⚠️ Verify HotMag/SmallMag
### Long Term (Next Release)
7. 📝 Mark deprecated vars in documentation
8. 🔔 Add runtime warnings for deprecated vars
9. 🗑️ Remove after deprecation cycle (3 releases)
## Impact Assessment
**Current state**: 221 ENV vars
**Safe to remove now**: 1 var (ULTRAHOT toggle)
**After verification**: Up to 21 vars (if all experimental features unused)
**Best case reduction**: ~10% (-22 vars)
## Detailed Plan
See `ENV_CLEANUP_PLAN.md` for:
- File-by-file breakdown
- Line numbers for all getenv() calls
- Priority ordering
- Risk assessment
- Verification questions