Skip to content

Commit 1f4b387

Browse files
grimmerkclaude
andcommitted
perf: change tail -n 200 to 100 (same hit rate, 18% faster)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9f00317 commit 1f4b387

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/claude-session-utility.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,8 @@ export const loadSessionEnrichment = async (sessions: ClaudeSession[]): Promise<
981981

982982
/**
983983
* Load last assistant response for active sessions.
984-
* Uses tail -n 200 to read the end of the JSONL file (fast even on 80MB files: ~19ms).
984+
* Uses tail -n 100 to read the end of the JSONL file (fast even on 80MB files).
985+
* Benchmark: 100 sessions parallel via Promise.all = ~150ms. tail -n 100 finds same hit rate as -n 200.
985986
* Returns a map of sessionId -> last assistant text.
986987
*/
987988
export const loadLastAssistantResponses = async (
@@ -1004,7 +1005,7 @@ export const loadLastAssistantResponses = async (
10041005

10051006
if (!fs.existsSync(jsonlPath)) return;
10061007

1007-
const output = await execPromise(`tail -n 200 "${jsonlPath}" | grep '"type":"assistant"' | tail -1`);
1008+
const output = await execPromise(`tail -n 100 "${jsonlPath}" | grep '"type":"assistant"' | tail -1`);
10081009
if (!output.trim()) return;
10091010

10101011
try {

0 commit comments

Comments
 (0)