Commit Graph

4 Commits

Author SHA1 Message Date
b80b3d445e Priority-2: ENV Cache - SFC (Super Front Cache) getenv() 置換
変更内容:
- hakmem_env_cache.h: 4つの新ENV変数を追加
  (SFC_DEBUG, SFC_ENABLE, SFC_CAPACITY, SFC_REFILL_COUNT)
- hakmem_tiny_sfc.c: 4箇所の getenv() を置換
  (init時のdebug/enable/capacity/refill設定)
  ※Per-class動的変数(2箇所)は初期化時のみのため後回し

効果: SFC層からも syscall を排除 (ENV変数数: 37→41)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 20:32:22 +09:00
38ce143ddf Priority-2: ENV Cache - SuperSlab Registry/LRU/Prewarm getenv() 置換
変更内容:
- hakmem_env_cache.h: 7つの新ENV変数を追加
  (SUPER_REG_DEBUG, SUPERSLAB_MAX_CACHED, SUPERSLAB_MAX_MEMORY_MB,
   SUPERSLAB_TTL_SEC, SS_LRU_DEBUG, SS_PREWARM_DEBUG, PREWARM_SUPERSLABS)
- hakmem_super_registry.c: 11箇所の getenv() を置換
  (Registry debug, LRU config, LRU debug x3, Prewarm debug x2, Prewarm config)

効果: SuperSlab管理層からも syscall を排除 (ENV変数数: 30→37)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 20:30:29 +09:00
936dc365ba Priority-2: ENV Cache - Warm Path (FastCache/SuperSlab) getenv() 置換
変更内容:
- hakmem_env_cache.h: 2つの新ENV変数を追加
  (TINY_FAST_STATS, TINY_UNIFIED_CACHE)
- tiny_fastcache.c: 2箇所の getenv() を置換
  (TINY_PROFILE, TINY_FAST_STATS)
- tiny_fastcache.h: 1箇所の getenv() を置換
  (TINY_PROFILE in inline function)
- superslab_slab.c: 1箇所の getenv() を置換
  (TINY_SLL_DIAG)
- tiny_unified_cache.c: 1箇所の getenv() を置換
  (TINY_UNIFIED_CACHE)

効果: Warm path層からも syscall を排除 (ENV変数数: 28→30)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 20:25:48 +09:00
802b6e775f Priority-2: ENV Variable Cache - ホットパスから syscall を完全排除
実装内容:
- 新規 Box: core/hakmem_env_cache.h (28個のENV変数をキャッシュ)
- hakmem.c: グローバルインスタンス + constructor 追加
- tiny_alloc_fast.inc.h: 7箇所の getenv() → キャッシュアクセサに置換
- tiny_free_fast_v2.inc.h: 3箇所の getenv() → キャッシュアクセサに置換

パフォーマンス改善:
- ホットパス syscall: ~2000回/秒 → 0回/秒
- 削減コスト: 約20万+ CPUサイクル/秒

設計:
- __attribute__((constructor)) でライブラリロード時に一度だけ初期化
- ゼロコストマクロ (HAK_ENV_*) でキャッシュ値にアクセス
- 箱理論 (Box Pattern) に準拠: 単一責任、ステートレス

次のステップ: 残り約20箇所のgetenv()も順次置換予定

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 20:16:58 +09:00