Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

Using the new watch api of compiler #74

Closed
wants to merge 10 commits into from
Closed

Using the new watch api of compiler #74

wants to merge 10 commits into from

Conversation

sheetalkamat
Copy link
Contributor

This works with the changes of microsoft/TypeScript#20234

@jrieken
Copy link
Owner

jrieken commented Nov 23, 2017

@sheetalkamat Would performance be like that of tsc --watch? That wouldn't be bad tho needs careful validation. My quick perf-test didn't reveal much of a different between them which is good needs. This is what I did

Start compilers, let them start and listen for changes, then:

  1. in arrays.ts, line 34, change low to lw to test a local change
  2. in arrays.ts, line 33, change binarySearch to binrySearch to test a real shape change
  3. in decorationsService.ts change _disposable on line 233 to _dispsable to test a local change

Results (as read from the terminal) are very similar, values are ordered 'tsc vs. tsb':

  1. 1 sec vs 770ms, undoing 1sec vs 312ms
  2. 5sec vs 4843ms, undoing 4sec vs 3836ms
  3. 1sec vs 283ms, undoing 0sec vs 239ms

@sheetalkamat I assume the performance of the new gulp-tsb will be very similar to tsc --watch. That would be good. I can selfhost of tsc for day to get a feel for it. All of this is very good news. Thanks for doing this!

tsc -p src/tsconfig.json --watch

jrieken:~/Code/vscode$ tsc -p src/tsconfig.json --watch
11:40:33 - Compilation complete. Watching for file changes.


11:40:47 - File change detected. Starting incremental compilation...


src/vs/base/common/arrays.ts(34,6): error TS6133: 'lw' is declared but its value is never read.
src/vs/base/common/arrays.ts(37,9): error TS2304: Cannot find name 'low'.
src/vs/base/common/arrays.ts(38,15): error TS2304: Cannot find name 'low'.
src/vs/base/common/arrays.ts(41,4): error TS2304: Cannot find name 'low'.
src/vs/base/common/arrays.ts(48,11): error TS2304: Cannot find name 'low'.
11:40:48 - Compilation complete. Watching for file changes.


11:40:54 - File change detected. Starting incremental compilation...


11:40:55 - Compilation complete. Watching for file changes.


11:41:06 - File change detected. Starting incremental compilation...


src/vs/base/test/common/arrays.test.ts(182,23): error TS2551: Property 'binarySearch' does not exist on type 'typeof "/Users/jrieken/Code/vscode/src/vs/base/common/arrays"'. Did you mean 'binrySearch'?
src/vs/base/test/common/arrays.test.ts(183,23): error TS2551: Property 'binarySearch' does not exist on type 'typeof "/Users/jrieken/Code/vscode/src/vs/base/common/arrays"'. Did you mean 'binrySearch'?
src/vs/base/test/common/arrays.test.ts(186,23): error TS2551: Property 'binarySearch' does not exist on type 'typeof "/Users/jrieken/Code/vscode/src/vs/base/common/arrays"'. Did you mean 'binrySearch'?
src/vs/base/test/common/arrays.test.ts(187,23): error TS2551: Property 'binarySearch' does not exist on type 'typeof "/Users/jrieken/Code/vscode/src/vs/base/common/arrays"'. Did you mean 'binrySearch'?
src/vs/base/test/common/arrays.test.ts(188,23): error TS2551: Property 'binarySearch' does not exist on type 'typeof "/Users/jrieken/Code/vscode/src/vs/base/common/arrays"'. Did you mean 'binrySearch'?
src/vs/platform/telemetry/browser/errorTelemetry.ts(8,10): error TS2305: Module '"/Users/jrieken/Code/vscode/src/vs/base/common/arrays"' has no exported member 'binarySearch'.
src/vs/workbench/parts/output/browser/outputServices.ts(9,10): error TS2305: Module '"/Users/jrieken/Code/vscode/src/vs/base/common/arrays"' has no exported member 'binarySearch'.
11:41:11 - Compilation complete. Watching for file changes.


11:41:16 - File change detected. Starting incremental compilation...


11:41:20 - Compilation complete. Watching for file changes.


11:41:31 - File change detected. Starting incremental compilation...


src/vs/workbench/services/decorations/browser/decorationsService.ts(233,19): error TS6133: '_dispable' is declared but its value is never read.
src/vs/workbench/services/decorations/browser/decorationsService.ts(240,8): error TS2551: Property '_dispoable' does not exist on type 'DecorationProviderWrapper'. Did you mean '_dispable'?
src/vs/workbench/services/decorations/browser/decorationsService.ts(256,8): error TS2551: Property '_dispoable' does not exist on type 'DecorationProviderWrapper'. Did you mean '_dispable'?
11:41:31 - Compilation complete. Watching for file changes.


11:41:34 - File change detected. Starting incremental compilation...


11:41:34 - Compilation complete. Watching for file changes.


^C

npm run watch

[11:43:00] Starting 'watch-client'...
[11:44:03] [monaco.d.ts] Starting monaco.d.ts generation
[11:44:06] [monaco.d.ts] Finished monaco.d.ts generation
[11:44:06] Finished compilation with 0 errors after 77678 ms
[11:44:33] Starting compilation...
[11:44:33] Error: /Users/jrieken/Code/vscode/src/vs/base/common/arrays.ts(34,6): 'lw' is declared but its value is never read.
[11:44:33] Error: /Users/jrieken/Code/vscode/src/vs/base/common/arrays.ts(37,9): Cannot find name 'low'.
[11:44:33] Error: /Users/jrieken/Code/vscode/src/vs/base/common/arrays.ts(38,15): Cannot find name 'low'.
[11:44:33] Error: /Users/jrieken/Code/vscode/src/vs/base/common/arrays.ts(41,4): Cannot find name 'low'.
[11:44:33] Error: /Users/jrieken/Code/vscode/src/vs/base/common/arrays.ts(48,11): Cannot find name 'low'.
[11:44:33] Finished compilation with 5 errors after 770 ms
[11:44:37] Starting compilation...
[11:44:37] Finished compilation with 0 errors after 312 ms
[11:44:42] Starting compilation...
[11:44:47] Error: /Users/jrieken/Code/vscode/src/vs/base/test/common/arrays.test.ts(182,23): Property 'binarySearch' does not exist on type 'typeof "/Users/jrieken/Code/vscode/src/vs/base/common/arrays"'. Did you mean 'binrySearch'?
[11:44:47] Error: /Users/jrieken/Code/vscode/src/vs/base/test/common/arrays.test.ts(183,23): Property 'binarySearch' does not exist on type 'typeof "/Users/jrieken/Code/vscode/src/vs/base/common/arrays"'. Did you mean 'binrySearch'?
[11:44:47] Error: /Users/jrieken/Code/vscode/src/vs/base/test/common/arrays.test.ts(186,23): Property 'binarySearch' does not exist on type 'typeof "/Users/jrieken/Code/vscode/src/vs/base/common/arrays"'. Did you mean 'binrySearch'?
[11:44:47] Error: /Users/jrieken/Code/vscode/src/vs/base/test/common/arrays.test.ts(187,23): Property 'binarySearch' does not exist on type 'typeof "/Users/jrieken/Code/vscode/src/vs/base/common/arrays"'. Did you mean 'binrySearch'?
[11:44:47] Error: /Users/jrieken/Code/vscode/src/vs/base/test/common/arrays.test.ts(188,23): Property 'binarySearch' does not exist on type 'typeof "/Users/jrieken/Code/vscode/src/vs/base/common/arrays"'. Did you mean 'binrySearch'?
[11:44:47] Error: /Users/jrieken/Code/vscode/src/vs/platform/telemetry/browser/errorTelemetry.ts(8,10): Module '"/Users/jrieken/Code/vscode/src/vs/base/common/arrays"' has no exported member 'binarySearch'.
[11:44:47] Error: /Users/jrieken/Code/vscode/src/vs/workbench/parts/output/browser/outputServices.ts(9,10): Module '"/Users/jrieken/Code/vscode/src/vs/base/common/arrays"' has no exported member 'binarySearch'.
[11:44:47] Finished compilation with 7 errors after 4843 ms
[11:44:51] Starting compilation...
[11:44:55] Finished compilation with 0 errors after 3836 ms
[11:45:12] Starting compilation...
[11:45:12] Error: /Users/jrieken/Code/vscode/src/vs/workbench/services/decorations/browser/decorationsService.ts(233,19): '_dispable' is declared but its value is never read.
[11:45:12] Error: /Users/jrieken/Code/vscode/src/vs/workbench/services/decorations/browser/decorationsService.ts(240,8): Property '_dispoable' does not exist on type 'DecorationProviderWrapper'. Did you mean '_dispable'?
[11:45:12] Error: /Users/jrieken/Code/vscode/src/vs/workbench/services/decorations/browser/decorationsService.ts(256,8): Property '_dispoable' does not exist on type 'DecorationProviderWrapper'. Did you mean '_dispable'?
[11:45:12] Finished compilation with 3 errors after 283 ms
[11:45:15] Starting compilation...
[11:45:15] Finished compilation with 0 errors after 239 ms

@sheetalkamat
Copy link
Contributor Author

@jrieken Yes this would use the same api to create program and update them as watch does with few changes. tsc -w watches files/directories but I wasn't sure how and what to do about that here since I am not very clear on how and when build is invoked. If you look at https://github.com/jrieken/gulp-tsb/pull/74/files#diff-f8924a760912596517f9ae8931e4f7a5R658 and https://github.com/jrieken/gulp-tsb/pull/74/files#diff-f8924a760912596517f9ae8931e4f7a5R662 the implementations currently just keep track of files/directories watched instead of using ts.sys.watchFile/ts.sys.watchDirectory. I wasn't sure what to do about that and wasn't sure if caller of the build is watching those files/directories or not.

@jrieken
Copy link
Owner

jrieken commented Dec 11, 2017

@sheetalkamat Against what version of TS will this run? Is this TS 2.6.x, 2.7, or still to be defined?

@sheetalkamat
Copy link
Contributor Author

@jrieken this runs against branch from microsoft/TypeScript#20234 which is yet to be merged.

@sheetalkamat
Copy link
Contributor Author

Closing this in favor of #76

@sheetalkamat sheetalkamat deleted the builderApi branch February 8, 2018 22:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants