codeburn/tsup.config.ts
iamtoruk cb9fa71623 perf(parser): parallelize the cold Claude parse across worker threads
Reading, decoding and line-parsing a Claude session JSONL is per-file work that
touches nothing shared, so it moves onto worker_threads for a large cold parse.
parseClaudeFileFull() is the extracted unit both sides run; a worker runs it
against an empty dedup set and returns the result as a JSON string, and the
parent installs results in the order the serial loop would. Everything with
cross-file state stays on the main thread, and a file whose message ids were
already claimed (or whose worker failed) re-parses in-process, so the output is
identical to the serial path.

Thread count is decided per parse: never with <=2 cores, under 2 GB free memory,
fewer than 200 pending whole-file re-parses or under 200 MB behind them, so warm
and incremental runs spawn nothing. CODEBURN_PARSE_WORKERS overrides it. The pool
is terminated when the parse ends, so the resident serve child accumulates no
threads.
2026-08-17 01:19:20 -07:00

13 lines
294 B
TypeScript

import { defineConfig } from 'tsup'
export default defineConfig({
entry: ['src/main.ts', 'src/parse-worker.ts'],
format: ['esm'],
target: 'node20',
outDir: 'dist',
clean: true,
splitting: false,
sourcemap: true,
dts: false,
external: ['@modelcontextprotocol/sdk', 'zod'],
})