Skip to content

chore: improve incremental typecheck performance - #40925

Open
jlongster wants to merge 8 commits into
v2from
core-typecheck
Open

chore: improve incremental typecheck performance#40925
jlongster wants to merge 8 commits into
v2from
core-typecheck

Conversation

@jlongster

@jlongster jlongster commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add explicit variance annotations around the Effect Drizzle query graph
  • enable persistent incremental metadata for Core's source and tests configs
  • make Core source a declaration-emitting composite project consumed by the tests/scripts config
  • make TUI consume Core declarations through a project reference
  • make internal migration, error, and plugin types portable for declaration emit

Performance

Measured in packages/core on Linux with 2 AMD EPYC 9554P cores and Bun 1.3.14:

Scenario Before After
clean check 9.10s 13.39s
unchanged check 1.09s 0.06s
Session implementation edit 10.21s 2.98s
provider adapter edit about 10s 1.09s

The clean build is slower because it emits the Core declaration boundary. Normal edit/typecheck feedback is substantially faster because build mode can compare the source declaration signature and skip the downstream tests/scripts project when public types are unchanged.

The variance annotations independently reduced clean Core type instantiations by roughly 264k and improved the original clean median by about 3.9%.

TUI results:

Scenario Before After
normal check with Core declarations built 9.61s 2.73s
tiny TUI edit 9.18s 3.08s
fresh check including Core declaration build 9.61s 12.50s

The TUI program drops from 3,441 files to 1,988 files and resolves zero Core source files. Its package script builds Core declarations first for direct-package correctness, while Turbo orders the Core typecheck task before TUI to avoid concurrent declaration writes.

Validation

  • bun turbo typecheck --concurrency=1 (32/32 tasks passed)
  • bun turbo typecheck --filter=@opencode-ai/tui --concurrency=1 --force
  • focused instruction/session tests (40 passed)
  • focused provider and database migration tests (28 passed)

@jlongster jlongster changed the title chore(core): improve incremental typecheck performance chore: improve incremental typecheck performance Aug 6, 2026
@Brendonovich

Copy link
Copy Markdown
Member

about time woohoo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants