Component commits:
ca35546663 Add test that fails
c7b5005aca Handle noEmit on semantic builder's emit as well
6a05abdff8 Add test for tsbuildinfo text verification
8bae5210ee Fix noEmit handling for tsbuildinfo emit with SemanticDiagnosticBuilder
0fd4a08b75 Add test for noEmitOnError with SemanticDiagnosticsBuilder
4fa1d78a6c Fix tsbuildinfo emit with SemanticDiagnosticsBuilder on noEmitOnError
a3968e7574 Update src/compiler/builder.ts
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
174b00a9a6 Update src/compiler/builder.ts
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
The exception thrown by Node.js's fs.statSync function contains a stack
trace that can be expensive to compute. Since this exception isn't used
by fileSystemEntryExists, we can safely set Error.stackTraceLimit to 0
without a change in behavior.
---
A significant performance improvement was noticed with this change while
profiling tsserver on packages within a proprietary monorepo.
Specifically, my team saw high self time percentages for Node.js's
uvException and handleErrorFromBinding internal functions. These
functions are executed within fs.statSync when it fails to find the
given path.
https://user-images.githubusercontent.com/906558/90183227-220cb800-dd81-11ea-8d61-f41f89481f46.png
fs.statSync: https://github.com/nodejs/node/blob/v14.4.0/lib/fs.js#L1030-L1037
handleErrorFromBinding: https://github.com/nodejs/node/blob/v14.4.0/lib/internal/fs/utils.js#L254-L269
uvException: https://github.com/nodejs/node/blob/v14.4.0/lib/internal/errors.js#L390-L443
## Measurements
After adding Error.stackTraceLimit = 0, we saw:
- For a large configured project with 12,565 files, tsserver reached the
projectLoadingFinish event 48.78% faster. (~46.786s vs ~31.447s)
- For a medium project with 7,064 files, tsserver was 25.75% faster.
(~20.897s vs ~16.618s)
- For a small project with 796 files, tsserver was only a negligible
3.00% faster. (~3.545s vs ~3.442)
Measurements were taken on macOS 10.15.6, Node.js 14.4.0, and a recent
master commit of TypeScript (610fa28d). The average of 3 runs before and
after this change were taken.
I would normally include .cpuprofile and isolate-*-*-*.log files, but
can't post them publicly in this case. If there's any other summaries
the TypeScript team would be curious about I can report them.
## fs.statSync Misses
Within our monorepo, the fs.statSync misses were mostly searches for
alternative file extensions of module imports.
- For node_modules imports, a lot of .ts/.tsx lookups failed until the
.d.ts file was found.
- Within projects with a lot of JSX files, .ts files were looked for
before finding the .tsx version.
- In the medium scale project mentioned above, a total of 38,515
non-existent files were queried during createProgram.
Component commits:
1582b76053 Revert "Add '(approximate)' to the beginning of quick info requests in PartialSemantic mode (#40061)"
This reverts commit 2426eb4980.
Co-authored-by: Daniel Rosenwasser <drosen@microsoft.com>
Component commits:
8f442baa3c Revert to including only open files in partial semantic server mode
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
* Cherry-pick PR #40005 into release-4.0
Component commits:
fa1ed85593 feat(40004): make isNamedTupleMember public
* Update LKG
Co-authored-by: Alexander T <alexander.tarasyuk@outlook.com>
Co-authored-by: typescript-bot <typescript@microsoft.com>
Component commits:
6e5d75b58b Use isUncalledFunctionReference for aliases too
Fixes bogus deprecated notices on imports of functions with deprecated
overloads, but with some non-deprecated overloads.
Fixesmicrosoft/vscode#104238e2eb319e72 Just check all declarations, don't call isUncalledFunction
Co-authored-by: Nathan Shively-Sanders <nathansa@microsoft.com>
PR #38449 changed the second overload of the constructor for Int8,
Uint8, Int32, Uint32, Int16, Uint16, Float, Float64 -Array so that it no
longer includes `ArrayBufferLike`. It's just `ArrayLike<number>`.
This is fine except in the case that
the caller provides exactly `ArrayLike<number> | ArrayBufferLike`. This
PR adds ArrayBufferLike back so that the union is once again accepted.
This avoids a breaking change, in particular in one Microsoft-internal
codebase.
* Add separate flag serverMode for server mode to allow back compatibility
* Addressed code review feedback.
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Limit auto import provider project size
* Add test
* Make option configurable
* Fix test
* Only bail when setting is auto
* Fix other test
* Update API baseline