Commit graph

132 commits

Author SHA1 Message Date
Nayeem Rahman 24fa5c784a
perf(lsp): release unused documents (#23398) 2024-04-17 21:40:42 +01:00
David Sherret 6f278e5c40
fix(lsp): improved cjs tracking (#23374)
Our cjs tracking was a bit broken. It was marking stuff as esm that was
actually cjs leading to type checking errors.
2024-04-15 17:50:52 -04:00
David Sherret 1835b4f061
fix(lsp): ensure project version is incremented when config changes (#23366)
I'm running into a node resolution bug in the lsp only and while
tracking it down I noticed this one.

Fixed by moving the project version out of `Documents`.
2024-04-15 00:07:04 +00:00
Nathan Whitaker 3dacba5057
perf(lsp): Only deserialize response from op_respond once (#23349)
Previously we were deserializing it twice - once to `serde_json::Value`,
and then again from the `serde_json::Value` to a concrete type
2024-04-12 16:04:54 -07:00
Nayeem Rahman f1ea8ca358
perf(lsp): use a stub module in tsc for failed resolutions (#23313) 2024-04-11 21:55:27 +01:00
Nayeem Rahman 34e1d0cdd4
perf(lsp): replace document registry source cache on update (#23311) 2024-04-11 02:57:22 +01:00
Nathan Whitaker 736f73b008
perf(lsp): Only evict caches on JS side when things actually change (#23293)
Currently we evict a lot of the caches on the JS side of things on every
request, namely script versions, script file names, and compiler
settings (as of #23283, it's not quite every request but it's still
unnecessarily often).

This PR reports changes to the JS side, so that it can evict exactly the
caches that it needs too. We might want to do some batching in the
future so as not to do 1 request per change.
2024-04-10 18:06:37 -07:00
Nayeem Rahman 214bfa37aa
perf(lsp): cache ts config in isolate until new project version (#23283) 2024-04-08 22:20:20 +01:00
Nayeem Rahman 3c346c8ea6
perf(lsp): don't pass remote modules as tsc roots (#23259) 2024-04-08 19:45:20 +01:00
Nayeem Rahman 9752a153ea
Revert "perf(lsp): Don't retain SourceFileObjects in sourceFileCache longer than necessary (#23258)" (#23285) 2024-04-08 18:57:25 +01:00
Nathan Whitaker b74a4f29f2
perf(lsp): Don't retain SourceFileObjects in sourceFileCache longer than necessary (#23258)
The TS language service requests source files via
[getSourceFile](7a25fd5ef0/cli/tsc/99_main_compiler.js (L560)).
In that function, we [unconditionally
add](7a25fd5ef0/cli/tsc/99_main_compiler.js (L613-L614))
the source file to our sourceFileCache. The issue is that we only remove
things from that cache if the source file [becomes out of
date](7a25fd5ef0/cli/tsc/99_main_compiler.js (L777-L783)).
For files that don't get changed, we keep them in the cache
indefinitely. So sometimes we keep SourceFile objects from being GC'ed
because they're retained in our cache, even though TS doesn't refer to
them any more. I see this in pretty much all of the heap snapshots I've
taken.

---

The fix here is pretty direct - just store weak references to the
sourcefiles in the cache. It doesn't really change our caching behavior,
it just prevents us from being the only retainer of a `SourceFile`. I
also split the `sourceFileCache` into a separate cache just for assets,
as we rely on those being alive.

The simpler fix is to only cache assets, but presumably that has a perf
impact.

---
In local testing, this PR reduced the size of the JS heap by about 1 GB
when using `deno lsp` in the Typescript repo.
2024-04-06 19:22:37 -07:00
Nayeem Rahman 524e451bfb
fix(lsp): implement missing ts server host apis (#23131) 2024-03-29 20:00:58 +00:00
David Sherret 49f97d5f85
fix(check): do not suggest running with --unstable (#23092)
Closes #23079
2024-03-27 11:58:36 -04:00
Nayeem Rahman 3b61104e2a
refactor(lsp): unify config file data into ConfigTree (#23032) 2024-03-26 15:52:20 +00:00
Bartek Iwańczuk 71551c80a1
feat(unstable): remove Deno.upgradeHttp API (#21856)
Closes https://github.com/denoland/deno/issues/21828.

This API is a huge footgun. And given that "Deno.serveHttp" is a
deprecated API that is discouraged to use (use "Deno.serve()" 
instead); it makes no sense to keep this API around.

This is a step towards fully migrating to Hyper 1.
2024-01-22 21:35:39 +00:00
Nayeem Rahman 0234eb23dd
fix(lsp): implement host.getGlobalTypingsCacheLocation() (#21882) 2024-01-10 13:16:30 +00:00
Nayeem Rahman ee45d5bf8f
perf(lsp): use host-owned cache for auto-import completions (#21852) 2024-01-08 17:05:05 +00:00
David Sherret 7e72f3af61
chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
Nayeem Rahman 48dae2441c
perf(lsp): use LanguageServiceHost::getProjectVersion() (#21719) 2023-12-28 00:13:57 +00:00
Nayeem Rahman 7d88e48296
perf(lsp): use null types instead of stub modules (#21541) 2023-12-12 10:26:27 +00:00
Bartek Iwańczuk 7bf267c197
perf(lsp): simplify some of the startup code (#21538)
Remove some dead code in "99_main_compiler.js". Eagerly start the LSP
TSC host, it was adding some not needed complexity around the TSC thread code.
2023-12-11 16:59:09 +01:00
David Sherret 68d356eed9
feat: TypeScript 5.3 (#21480)
https://github.com/denoland/TypeScript/pull/9
2023-12-06 18:49:34 -05:00
Bartek Iwańczuk 39c7d8dafe
refactor: faster args for op_load in TSC (#21438)
This commit changes the argument that "op_load" accepts, from
a serde struct to "&str". This should equal to a slightly better
performance.
2023-12-03 02:07:04 +00:00
Nayeem Rahman 0f990d9d92
perf(lsp): fix redundant serialization of sources (#21435) 2023-12-02 23:28:46 +00:00
Bartek Iwańczuk ec0207e9b1
perf(lsp): better op performance logging (#21423) 2023-12-01 22:57:52 +01:00
Bartek Iwańczuk c803c0eaab
perf(lsp): remove throttling of cancellation token (#21395)
This commit removes "ThrottledCancellationToken" in favor of
"CancellationToken".

Since calling into Rust to check if Tokio's cancellation token has
already been canceled is really cheap, there's no need for us to 
throttle this check and let TSC burn up CPU with heavy computation.
2023-11-30 15:43:35 +00:00
Bartek Iwańczuk 587f2e0800
feat: precompile JSX (#20962)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2023-11-01 20:30:23 +00:00
Luca Casonato d42f154312
feat: disposable Deno resources (#20845)
This commit implements Symbol.dispose and Symbol.asyncDispose for
the relevant resources.

Closes #20839

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-01 20:26:12 +01:00
Nayeem Rahman 6fd2d08418
refactor(lsp): clean up tsc requests (#20743) 2023-10-02 07:32:05 +01:00
Nayeem Rahman 86c04f43e0
fix(lsp): pass quote preference to tsc (#20547) 2023-09-18 20:48:32 +01:00
Nayeem Rahman 6f077ebb07
feat(lsp): update imports on file rename (#20245)
Closes https://github.com/denoland/vscode_deno/issues/410.
2023-08-26 02:50:47 +02:00
Nayeem Rahman 6de35e4b2e
fix(lsp): pass fmt options to completion requests (#20184)
Fixes https://github.com/denoland/vscode_deno/issues/856.
2023-08-17 10:46:11 -04:00
David Sherret b563746885
fix: deno diagnostic - clarify where to put triple-slash directive (#20009)
Some people might not know what "entrypoint" means or where to put the
triple-slash directive.
2023-08-01 15:27:25 +00:00
David Sherret b03d82e5d3
fix(tsc): more informative diagnostic when Deno does not exist (#19825)
Also improved the diagnostic when using something like `Deno.openKv` and
it doesn't exist.
2023-07-13 23:29:51 +00:00
David Sherret ae1ba2af3c
perf(check): faster source hashing (#18534) 2023-04-01 10:12:40 -04:00
David Sherret 23b9be7b37
fix(check): ensure diagnostics caused by changes in other files get invalidated between runs (#18541)
Regression caused by the performance improvement in #18329. Figuring
this out was hard. It's luckily still fast after this change.

Closes #18516
2023-04-01 10:04:56 -04:00
David Sherret c4f82cab31
fix(lsp): textDocument/references should respect includeDeclaration (#18496) 2023-03-30 16:15:21 +00:00
David Sherret 675179a176
chore(types): fix type checking errors in 99_main_compiler.js (#18403) 2023-03-24 10:35:44 -04:00
David Sherret 253b556e6f
perf(check): type check local files only when not using --all (#18329)
Closes #18171
2023-03-21 18:19:42 -04:00
David Sherret 2fcf1f14cf
feat: TypeScript 5.0.2 (except decorators) (#18294)
This upgrades TypeScript to 5.0.2, but does not have ES decorator
support because swc does not support that yet.
2023-03-21 15:46:40 +00:00
David Sherret 8db853514c
fix(check): regression where config "types" entries caused type checking errors (#18124)
Closes #18117
Closes #18121 (this is just over 10ms faster in a directory one up from
the root folder)

cc @nayeemrmn
2023-03-11 11:43:45 -05:00
David Sherret 2f98c3e1a6
chore: remove base64 encoding code from typescript snapshot (#17862)
This code is no longer used because we use swc for this now.
2023-02-21 22:56:58 -05:00
Bartek Iwańczuk fc2e00152b
feat: support node built-in module imports (#17264)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-01-24 09:05:54 -05:00
David Sherret 1712a88e69
refactor(tsc): do not store some typescript declaration file text in multiple places (#17410) 2023-01-14 09:36:19 -05:00
David Sherret 10e4b2e140
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-02 21:00:42 +00:00
David Sherret beaa0d8867
chore: more debug logging and avoid allocating strings in ts logging when not debug (#16689) 2022-11-23 13:34:44 -05:00
David Sherret 8864a1d10f
fix(lsp): regression - error when removing file (#16388) 2022-10-22 15:36:07 -04:00
David Sherret bcfe279fba
feat(unstable/npm): initial type checking of npm specifiers (#16332) 2022-10-21 15:20:18 +00:00
Kitson Kelly 7d78f58187
feat: support inlay hints (#16287)
Closes: #11853
2022-10-16 13:39:43 +11:00
Aapo Alasuutari 2164f6b1eb
perf(ops): Monomorphic sync op calls (#15337)
Welcome to better optimised op calls! Currently opSync is called with parameters of every type and count. This most definitely makes the call megamorphic. Additionally, it seems that spread params leads to V8 not being able to optimise the calls quite as well (apparently Fast Calls cannot be used with spread params).

Monomorphising op calls should lead to some improved performance. Now that unwrapping of sync ops results is done on Rust side, this is pretty simple:

```
opSync("op_foo", param1, param2);
// -> turns to
ops.op_foo(param1, param2);
```

This means sync op calls are now just directly calling the native binding function. When V8 Fast API Calls are enabled, this will enable those to be called on the optimised path.

Monomorphising async ops likely requires using callbacks and is left as an exercise to the reader.
2022-08-11 15:56:56 +02:00