Skip to content

Account nested declaration emits as emit time - #4557

Merged
Jake Bailey (jakebailey) merged 1 commit into
mainfrom
jabaile/tsgo-standalone-repro-slowdown
Aug 10, 2026
Merged

Account nested declaration emits as emit time#4557
Jake Bailey (jakebailey) merged 1 commit into
mainfrom
jabaile/tsgo-standalone-repro-slowdown

Conversation

@jakebailey

@jakebailey Jake Bailey (jakebailey) commented Jul 7, 2026

Copy link
Copy Markdown
Member

Incremental shape checking computes declaration signatures using nested declaration emits. Those emits were previously included in Check time and omitted from Emit time.

This tracks nested emit duration with the compilation System clock, moves that duration from Check time to Emit time, and adds a controlled-clock regression test around the full incremental compilation path.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns incremental build-info state and performance accounting more closely with Strada.

Changes:

  • Serializes clean-build file info compactly and records declaration signatures separately.
  • Tracks pre-update signatures across incremental processing.
  • Reclassifies forced declaration work as emit time and adds an incremental regression scenario.

Reviewed changes

Copilot reviewed 67 out of 232 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js Updates build-info baseline.
testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js Updates build-info baseline.
testdata/baselines/reference/tsc/projectReferences/redirects-to-the-output-dts-file.js Updates redirected-output baseline.
testdata/baselines/reference/tsc/projectReferences/issues-a-nice-error-when-the-input-file-is-missing.js Updates missing-input baseline.
testdata/baselines/reference/tsc/projectReferences/issues-a-nice-error-when-the-input-file-is-missing-when-module-reference-is-not-relative.js Updates non-relative import baseline.
testdata/baselines/reference/tsc/projectReferences/errors-when-the-referenced-project-doesnt-have-composite.js Updates project-reference error baseline.
testdata/baselines/reference/tsc/projectReferences/errors-when-the-referenced-project-doesnt-exist.js Updates missing-project baseline.
testdata/baselines/reference/tsc/projectReferences/errors-when-the-file-list-is-not-exhaustive.js Updates file-list error baseline.
testdata/baselines/reference/tsc/projectReferences/errors-when-declaration-=-false.js Updates declaration-option baseline.
testdata/baselines/reference/tsc/projectReferences/errors-when-a-file-is-outside-the-rootdir.js Updates root-directory error baseline.
testdata/baselines/reference/tsc/projectReferences/doesnt-infer-the-rootDir-from-source-paths.js Updates root inference baseline.
testdata/baselines/reference/tsc/projectReferences/default-setup-was-created-correctly.js Updates default project baseline.
testdata/baselines/reference/tsc/noEmitOnError/syntax-errors-with-declaration-with-incremental.js Compacts no-emit syntax-error state.
testdata/baselines/reference/tsc/noEmitOnError/semantic-errors-with-declaration-with-incremental.js Compacts no-emit semantic-error state.
testdata/baselines/reference/tsc/noEmitOnError/dts-errors-with-declaration-with-incremental.js Compacts declaration-error state.
testdata/baselines/reference/tsc/libraryResolution/when-noLib-toggles.js Updates library-resolution build info.
testdata/baselines/reference/tsc/incremental/serializing-composite-project.js Verifies composite serialization.
testdata/baselines/reference/tsc/extends/resolves-the-symlink-path.js Updates symlink build-info baseline.
testdata/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-no-crash-no-jsx-element.js Updates JSX composite baseline.
testdata/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-error-on-jsx-element.js Updates JSX error baseline.
testdata/baselines/reference/tsbuildWatch/programUpdates/when-referenced-project-change-introduces-error-in-the-down-stream-project-and-then-fixes-it.js Updates watched project state.
testdata/baselines/reference/tsbuildWatch/programUpdates/declarationEmitErrors-when-file-with-no-error-changes.js Updates watched emit-signature state.
testdata/baselines/reference/tsbuildWatch/dependencyUpdate/watches-absolute-non-root-dependency-updates.js Updates watched dependency baseline.
testdata/baselines/reference/tsbuild/solution/does-not-have-empty-files-diagnostic-when-files-is-empty-and-references-are-provided.js Updates solution build info.
testdata/baselines/reference/tsbuild/sample/when-declaration-option-changes.js Updates declaration-change state.
testdata/baselines/reference/tsbuild/resolveJsonModule/without-outDir.js Updates JSON-module build info.
testdata/baselines/reference/tsbuild/resolveJsonModule/sourcemap.js Updates JSON sourcemap build info.
testdata/baselines/reference/tsbuild/resolveJsonModule/include-only.js Updates JSON include baseline.
testdata/baselines/reference/tsbuild/resolveJsonModule/include-only-without-outDir.js Updates no-outDir JSON baseline.
testdata/baselines/reference/tsbuild/resolveJsonModule/include-only-with-json-without-rootDir-but-outside-configDirectory.js Updates external JSON baseline.
testdata/baselines/reference/tsbuild/resolveJsonModule/include-only-with-json-not-in-rootDir.js Updates out-of-root JSON baseline.
testdata/baselines/reference/tsbuild/resolveJsonModule/include-of-json-along-with-other-include.js Updates mixed-include baseline.
testdata/baselines/reference/tsbuild/resolveJsonModule/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js Updates matching-name JSON baseline.
testdata/baselines/reference/tsbuild/resolveJsonModule/include-and-files.js Updates include/files baseline.
testdata/baselines/reference/tsbuild/resolveJsonModule/importing-json-module-from-project-reference.js Updates referenced JSON baseline.
testdata/baselines/reference/tsbuild/resolveJsonModule/files-containing-json-file.js Updates explicit JSON-files baseline.
testdata/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/reports-error-for-same-tsbuildinfo-file.js Updates shared build-info baseline.
testdata/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/reports-error-for-same-tsbuildinfo-file-without-incremental.js Updates non-incremental variant.
testdata/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/reports-error-for-same-tsbuildinfo-file-without-incremental-with-tsc.js Updates tsc variant.
testdata/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/reports-error-for-same-tsbuildinfo-file-because-no-rootDir-in-the-base.js Updates inherited-rootDir variant.
testdata/baselines/reference/tsbuild/programUpdates/when-root-is-source-from-project-reference.js Updates referenced-root state.
testdata/baselines/reference/tsbuild/outputPaths/when-rootDir-is-specified-but-not-all-files-belong-to-rootDir-and-is-composite.js Updates composite output-path state.
testdata/baselines/reference/tsbuild/outputPaths/when-rootDir-is-not-specified-and-is-composite.js Updates inferred output-path state.
testdata/baselines/reference/tsbuild/noEmitOnError/syntax-errors-with-declaration-with-incremental.js Updates build-mode syntax-error state.
testdata/baselines/reference/tsbuild/noEmitOnError/semantic-errors-with-declaration-with-incremental.js Updates build-mode semantic-error state.
testdata/baselines/reference/tsbuild/noEmitOnError/dts-errors-with-declaration-with-incremental.js Updates build-mode declaration-error state.
testdata/baselines/reference/tsbuild/moduleResolution/when-resolution-is-not-shared.js Updates unshared-resolution signatures.
testdata/baselines/reference/tsbuild/moduleResolution/shared-resolution-should-not-report-error.js Updates shared-resolution signatures.
testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js Updates output declaration resolution.
testdata/baselines/reference/tsbuild/extends/resolves-the-symlink-path.js Updates build-mode symlink baseline.
testdata/baselines/reference/tsbuild/dependencyUpdate/rebuilds-when-missing-dependency-package-json-is-added.js Updates missing-package rebuild state.
testdata/baselines/reference/tsbuild/dependencyUpdate/rebuilds-when-dependency-package-json-redirects-to-a-different-declaration-file.js Updates redirected-package state.
testdata/baselines/reference/tsbuild/dependencyUpdate/rebuilds-when-dependency-in-node_modules-is-updated.js Updates dependency rebuild state.
testdata/baselines/reference/tsbuild/dependencyUpdate/rebuilds-when-absolute-non-root-dependency-is-updated.js Updates absolute-dependency state.
internal/execute/tsctests/tsc_test.go Adds the incremental comment-change scenario.
internal/execute/tsc/emit.go Reclassifies nested declaration emit time.
internal/execute/incremental/snapshottobuildinfo.go Serializes pre-update signatures.
internal/execute/incremental/snapshot.go Stores old signatures in snapshots.
internal/execute/incremental/programtosnapshot.go Carries uncommitted signatures forward.
internal/execute/incremental/program.go Tracks nested emit duration.
internal/execute/incremental/emitfileshandler.go Manages old signatures around emission.
internal/execute/incremental/affectedfileshandler.go Tracks shape-update signatures and nested emits.

Comment thread internal/execute/incremental/program.go Outdated
Comment thread internal/execute/tsctests/tsc_test.go Outdated
@jakebailey
Jake Bailey (jakebailey) force-pushed the jabaile/tsgo-standalone-repro-slowdown branch 2 times, most recently from 3abbc39 to 44d67f7 Compare July 23, 2026 15:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 74 out of 240 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 74 out of 240 changed files in this pull request and generated 1 comment.

Comment thread internal/execute/tsc/emit_test.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 76 out of 242 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 76 out of 242 changed files in this pull request and generated no new comments.

Suppressed comments (1)

internal/execute/incremental/emitfileshandler.go:224

  • This preserves the pre-emit signature even after the affected-file batch has emitted successfully, so snapshotToBuildInfo writes the source version as the file's shape and moves the committed .d.ts hash into emitSignatures. On the next process, an implementation-only edit is therefore compared against the source hash and is treated as a shape change. The new preserves-uncommitted-signatures-when-emitting-after-noEmit baseline demonstrates the regression: changing only b.ts's comment refreshes/re-emits c.ts. Strada only saves oldSignatures while an affected-file iteration is still rollbackable; otherwise the emitted signature is committed directly. Please retain the old value only for a genuinely in-progress/cancellable update, or clear it before writing build info after this emit batch succeeds.
							h.program.snapshot.oldSignatures.LoadOrStore(data.SourceFile.Path(), info.signature)

@jakebailey
Jake Bailey (jakebailey) force-pushed the jabaile/tsgo-standalone-repro-slowdown branch from 1a99023 to 67b4caa Compare August 10, 2026 19:44
Measure forced declaration-signature work with the compilation System clock and move that duration from Check time to Emit time. Add a controlled-clock regression test around the full incremental compile path.
@jakebailey
Jake Bailey (jakebailey) force-pushed the jabaile/tsgo-standalone-repro-slowdown branch from 67b4caa to 9848d14 Compare August 10, 2026 20:30
@jakebailey Jake Bailey (jakebailey) changed the title Get incremental mode closer to Strada Account nested declaration emits as emit time Aug 10, 2026
@jakebailey
Jake Bailey (jakebailey) requested a balanced review from Copilot August 10, 2026 20:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@jakebailey

Copy link
Copy Markdown
Member Author

This has been redone to just bring it to accounting correctly, the other stuff was junk

@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit 264a3a5 Aug 10, 2026
22 checks passed
@jakebailey
Jake Bailey (jakebailey) deleted the jabaile/tsgo-standalone-repro-slowdown branch August 10, 2026 22:15
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.

3 participants