Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@bradzacher
Copy link
Member

@bradzacher bradzacher commented Dec 6, 2022

Overview

This is just an experiment to help address memory issues (#1192), maybe performance, and maybe out-of-sync types (#5845).

I was looking into some code around the place and noticed that TS exposes the concept of a "document registry" - which is a shared cache that can be reused across certain TS data structures to deduplicate memory usage (and I assume improve performance by deduplicating work).

This PR implements a new parser strategy which uses TS's "Language Service" tooling, which in turn leverages the document registry. "persistent parse" tests pass - which at least proves that it works in some manner of speaking.

One interesting thing to note here is under the hood the language serivce doesn't use a builder program. I believe the idea is that the document registry is supposed to forego the performance implications of that? I don't know exactly - it will require more testing. Though it's worth mentioning that this means this could replace our current "single-run" codepaths because it doesn't use a builder program.

TODO:

  • figure out how to roll-back "dirty" states
  • memory pressure testing
  • runtime performance testing

… that uses a language service instead of a builder program

## PR Checklist

- [x] Steps in [CONTRIBUTING.md](https://github.com/typescript-eslint/typescript-eslint/blob/main/CONTRIBUTING.md) were taken

## Overview

This is just an experiment to help address memory issues (#1192), maybe performance, and maybe out-of-sync types (#5845).

I was looking into some code around the place and noticed that TS exposes the concept of a "document registry" - which is a shared cache that can be reused across certain TS data structures to deduplicate memory usage (and I assume improve performance by deduplicating work).

This PR implements a new parser strategy which uses TS's "Language Service" tooling, which in turn leverages the document registry. "persistent parse" tests pass - which at least proves that it works in some manner of speaking.

One interesting thing to note here is under the hood the language serivce doesn't use a builder program. I believe the idea is that the document registry is supposed to forego the performance implications of that? I don't know exactly - it will require more testing. Though it's worth mentioning that this means this could replace our current "single-run" codepaths because it doesn't use a builder program.

TODO:
- figure out how to roll-back "dirty" states
- memory pressure testing
- runtime performance testing
@nx-cloud
Copy link

nx-cloud bot commented Dec 6, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit a092809. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


🟥 Failed Commands
Node 18 - nx test typescript-estree
✅ Successfully ran 44 targets

Sent with 💌 from NxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @bradzacher!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

@netlify
Copy link

netlify bot commented Dec 6, 2022

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit a092809
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/638ed04fe6a60d000864dbdc
😎 Deploy Preview https://deploy-preview-6172--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@bradzacher bradzacher marked this pull request as draft December 6, 2022 05:01
@bradzacher
Copy link
Member Author

something weird is happening on the CI - dunno why it's OOMing.
cannot reproduce locally so that's fun.

@bradzacher
Copy link
Member Author

Cc @jakebailey I know you had an inclination about helping us improve the perf of the tooling.

I was hoping you could help me by providing some TS insider insight ☺

Do you think this approach will help out a lot compared to the existing builder program approach?
From what I can tell by poking around and reading it'll at least save us a bunch of memory - though not too sure about runtime cost/savings yet.

Would it be worth us building our own layer on top of the document registry instead of reusing the language service?

@jakebailey
Copy link
Collaborator

Honestly, I have no clue; @sheetalkamat or someone may have better insight.

@JoshuaKGoldberg
Copy link
Member

Closing this old draft for housekeeping since there are merge conflicts and it's taking up space in the open PRs list. Nothing bad will happen in my housekeeping if this is re-opened. Don't mind me. 😄

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2023
@bradzacher bradzacher reopened this Feb 27, 2023
@bradzacher bradzacher added the DO NOT MERGE PRs which should not be merged yet label Feb 27, 2023
@bradzacher bradzacher added the enhancement New feature or request label Apr 17, 2023
@JoshuaKGoldberg
Copy link
Member

@bradzacher do you still want to work on this now that EXPERIMENTAL_useProjectService is in (#6754)?

@bradzacher
Copy link
Member Author

Let's put a pin in this - if we find that the project service works for all cases then there's no need for us to worry about improving the manual config case, I think.
We may want to re-investigate this if there are strong usecases that it doesn't support - but I'm optimistic we won't have to.

@bradzacher bradzacher closed this Jul 17, 2023
@bradzacher bradzacher deleted the pr6172 branch July 17, 2023 02:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

DO NOT MERGE PRs which should not be merged yet enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.