Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

1.1 KB
Raw Blame

Desktop performance

Diff workers

Diff components own the lifetime of the syntax-highlighting worker pool. Opening a conversation without a diff does not start workers. Mounted diffs share one pool per renderer, capped at two workers and 200 entries in each AST cache. The last diff unmounting releases the pool. Languages load as files need them instead of preloading a review-wide language list.

DiffWorkerPool supplies the same configuration to conversation previews and code review. Place new diff renderers inside this boundary, rather than adding a provider around a whole page. This keeps the worker budget independent of which view opens first.

DiffWorkerPool.test.tsx guards the pool budget, the sharing, and the release. To check the lifecycle in the development app, open a plain conversation, open a diff, and then leave the diff. Inspect worker targets in Chromium DevTools: the plain conversation should have no diff workers, the diff should have two, and leaving all diffs should release them. Check syntax highlighting and large file scrolling in both conversation previews and code review.