Skip to content

Conversation

@sheetalkamat
Copy link
Member

No description provided.

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

Seemingly still logical races or something; note the CI failure:

Using D:\a\typescript-go\typescript-go\Herebyfile.mjs to run baseline-accept
Starting baseline-accept
Finished baseline-accept in 19ms
Completed baseline-accept in 20ms
diff --git a/testdata/baselines/reference/tsc/incremental/when-global-file-is-added,-the-signatures-are-updated.js b/testdata/baselines/reference/tsc/incremental/when-global-file-is-added,-the-signatures-are-updated.js
index e3612043..f4adbdf5 100644
--- a/testdata/baselines/reference/tsc/incremental/when-global-file-is-added,-the-signatures-are-updated.js
+++ b/testdata/baselines/reference/tsc/incremental/when-global-file-is-added,-the-signatures-are-updated.js
@@ -551,7 +551,6 @@ declare function something2(): number;
 //// [/home/src/workspaces/project/src/fileNotFound.js] *new* 
 function something2() { return 20; }
 
-//// [/home/src/workspaces/project/src/main.js] *modified time*
 //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* 
 {"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/filePresent.ts","./src/fileNotFound.ts","./src/anotherFileWithSameReferenes.ts","./src/newFile.ts","./src/main.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e-/// \u003creference no-default-lib=\"true\"/\u003e\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array\u003cT\u003e { length: number; [n: number]: T; }\ninterface ReadonlyArray\u003cT\u003e {}\ninterface SymbolConstructor {\n    (desc?: string | number): symbol;\n    for(name: string): symbol;\n    readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n    readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5-function something() { return 10; }","signature":"4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2-declare function something(): number;\n","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6c5b229cbf53b2c6867ab14b139eeac37ed3ec0c1564ba561f7faa869aaba32c-function something2() { return 20; }","signature":"14ba6a62cd6d3e47b343358b2c3e1b7e34b488b489f0d9b915c796cd2e61bbad-declare function something2(): number;\n","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d-/// \u003creference path=\"./filePresent.ts\"/\u003e\n/// \u003creference path=\"./fileNotFound.ts\"/\u003e\nfunction anotherFileWithSameReferenes() { }","signature":"d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda-declare function anotherFileWithSameReferenes(): void;\n","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a4c88e3619994da0f5e4da2dc210f6038e710b9bb831003767da68c882137fb1-function foo() { return 20; }","signature":"f0d67d5e01f8fff5f52028627fc0fb5a78b24df03e482ddac513fa1f873934ee-declare function foo(): number;\n","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"930f3c7023d87506648db3c352e86f7a2baf38e91f743773fddf4a520aff393a-/// \u003creference path=\"./newFile.ts\"/\u003e\n/// \u003creference path=\"./filePresent.ts\"/\u003e\n/// \u003creference path=\"./fileNotFound.ts\"/\u003e\nfunction main() { }something();something();foo();","signature":"ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896-declare function main(): void;\n","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[2,3],[2,3,5]],"options":{"composite":true},"referencedMap":[[4,1],[6,2]],"latestChangedDtsFile":"./src/fileNotFound.d.ts"}
 //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* 

@jakebailey
Copy link
Member

The CI is still racing, unfortunately; is there any way we could just not do the concurrency stuff and just make it slower but definitely correct?

@sheetalkamat
Copy link
Member Author

i am looking at the race and checking whats the issue. I cant repro it on my windows laptop but looking at the log to see whats going on

@sheetalkamat sheetalkamat requested a review from jakebailey July 23, 2025 16:41
@sheetalkamat sheetalkamat requested a review from jakebailey July 23, 2025 19:00
@sheetalkamat sheetalkamat requested a review from jakebailey July 23, 2025 19:49

// Get the module source file and all augmenting files from the import name node from file
func addReferencedFilesFromImportLiteral(file *ast.SourceFile, referencedFiles *collections.Set[tspath.Path], checker *checker.Checker, importName *ast.LiteralLikeNode) {
symbol := checker.GetSymbolAtLocation(importName)
Copy link
Member

Choose a reason for hiding this comment

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

Pretty shocked that this is how it used to work; was not aware this function was ever used outside services, and yet the old code did do this.

Is it actually necessary to collect info at this level of granularity? Would it be sufficient to just in the Program remember info from file loading to know file references or something?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since this is a port, i would like to keep this as is and then we can revisit this part for better perf and understanding the scnearios. Its constrained to single function and should be easy to swap out to better logic later

Copy link
Member

Choose a reason for hiding this comment

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

Certainly, yes; I'm at least glad that this doesn't cause races.

@jakebailey
Copy link
Member

jakebailey commented Jul 24, 2025

Neat

image

Compare to tsc

image
  • tsc first build, 8.8s
  • tsc second build, 1.4s
  • tsgo first build, 1.4s
  • tsgo second build, 0.17s

So tsgo can quite literally do full incremental build skipping in the time it takes nodejs to start tsc.

@sheetalkamat sheetalkamat added this pull request to the merge queue Jul 24, 2025
Merged via the queue into main with commit 5e6bd1e Jul 24, 2025
22 checks passed
@sheetalkamat sheetalkamat deleted the incremental branch July 24, 2025 04:24
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