1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00
denoland-deno/cli
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
..
args FUTURE: override byonm with nodeModulesDir setting (#23222) 2024-04-05 10:34:51 -04:00
bench chore(ext/io): remove use of deprecated Deno.writeSync() (#22872) 2024-03-20 10:39:25 -07:00
cache fix: prevent cache db errors when deno_dir not exists (#23168) 2024-04-01 18:58:52 -04:00
js fix: don't panic in test and bench if ops not available (#23055) 2024-03-24 16:16:45 -07:00
lsp refactor(lsp): remove DocumentInner (#23251) 2024-04-06 15:36:43 +01:00
napi chore: forward v1.42.1 release commit to main (#23162) 2024-04-01 13:35:46 +05:30
npm perf(lsp): use lockfile to reduce npm pkg resolution time (#23247) 2024-04-05 22:33:01 +00:00
ops refactor(bench): align ops to testing ops (#23038) 2024-03-24 06:22:37 +01:00
schemas fix(config): remove pkg name example and add pattern to schema (#22813) 2024-03-08 23:13:25 +00:00
standalone FUTURE: override byonm with nodeModulesDir setting (#23222) 2024-04-05 10:34:51 -04:00
tools FUTURE: override byonm with nodeModulesDir setting (#23222) 2024-04-05 10:34:51 -04:00
tsc perf(lsp): Don't retain SourceFileObjects in sourceFileCache longer than necessary (#23258) 2024-04-06 19:22:37 -07:00
util feat: add --watch-exclude flag (#21935) 2024-03-27 22:47:46 +00:00
auth_tokens.rs fix(cli): Add IP address support to DENO_AUTH_TOKEN (#22297) 2024-02-06 19:45:40 +01:00
build.rs feat: TypeScript 5.4 (#23086) 2024-03-26 18:52:57 -04:00
Cargo.toml chore: forward v1.42.1 release commit to main (#23162) 2024-04-01 13:35:46 +05:30
cdp.rs refactor(tools/repl): reorganize code (#21810) 2024-01-05 16:14:58 +01:00
deno.ico fix(cli): add icon and metadata to deno.exe on Windows (#6693) 2020-07-15 21:54:38 +02:00
emit.rs refactor: load bytes in deno_graph (#22212) 2024-02-01 03:15:22 +00:00
entitlements.plist chore: start codesigning mac release builds (#21303) 2023-11-23 15:30:26 -07:00
errors.rs fix: upgrade to deno_ast 0.33 (#22341) 2024-02-09 01:40:26 +00:00
factory.rs FUTURE: override byonm with nodeModulesDir setting (#23222) 2024-04-05 10:34:51 -04:00
file_fetcher.rs fix: handle cache body file not existing when using etag (#22931) 2024-03-15 09:57:24 -04:00
graph_util.rs fix: stop type checking during runtime (#22854) 2024-03-13 16:38:01 -04:00
http_util.rs chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
integration_tests_runner.rs chore: continue tests/ re-org (#22396) 2024-02-12 17:13:14 -07:00
js.rs chore(cli): remove problematic snapshot test (#22722) 2024-03-05 19:11:33 -07:00
jsr.rs fix(jsr): exclude yanked versions from 'deno add' and completions (#23113) 2024-03-28 19:02:07 +00:00
main.rs refactor: cleanup main entrypoint (#23145) 2024-03-31 10:58:19 -04:00
mainrt.rs refactor: cleanup main entrypoint (#23145) 2024-03-31 10:58:19 -04:00
module_loader.rs chore: upgrade deno_core to 0.272.0 (#23022) 2024-03-21 13:57:32 -07:00
node.rs feat(node): load ES modules defined as CJS (#22945) 2024-03-21 11:35:51 -07:00
README.md docs(cli): do not need gen doc for cli (#17260) 2023-01-04 13:19:58 +01:00
resolver.rs perf(node): put pkg json into an Rc (#23156) 2024-04-01 09:10:04 -04:00
version.rs chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
worker.rs FUTURE: remove deprecated APIs within workers (#23220) 2024-04-05 03:27:18 +11:00

Deno CLI Crate

crates

This provides the actual deno executable and the user-facing APIs.

The deno crate uses the deno_core to provide the executable.