docs: 合并性能分析报告并优化内存管理

将 performance-reporter.md 合入 memory-peak-analysis.md,统一分析文档。
代码优化包括:compact 峰值释放、GC 阈值触发、虚拟滚动参数调优、
HybridTransport 队列缩减、无界缓存加 LRU 淘汰、taskSummary 避免数组拷贝。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-05-02 09:11:12 +08:00
parent ef10ad2839
commit 0977b0520e
8 changed files with 193 additions and 166 deletions

View File

@@ -10,7 +10,11 @@ import type {
SystemFileSnapshotMessage,
UserMessage,
} from 'src/types/message.js'
import { getPlanSlugCache, getSessionId } from '../bootstrap/state.js'
import {
getPlanSlugCache,
getSessionId,
setPlanSlugCacheEntry,
} from '../bootstrap/state.js'
import { EXIT_PLAN_MODE_V2_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/ExitPlanModeTool/constants.js'
import { getCwd } from './cwd.js'
import { logForDebugging } from './debug.js'
@@ -43,7 +47,7 @@ export function getPlanSlug(sessionId?: SessionId): string {
break
}
}
cache.set(id, slug!)
setPlanSlugCacheEntry(id, slug!)
}
return slug!
}
@@ -52,7 +56,7 @@ export function getPlanSlug(sessionId?: SessionId): string {
* Set a specific plan slug for a session (used when resuming a session)
*/
export function setPlanSlug(sessionId: SessionId, slug: string): void {
getPlanSlugCache().set(sessionId, slug)
setPlanSlugCacheEntry(sessionId, slug)
}
/**