rescript-lang / rescript-lang/rescript-vscode
Design: reduce latency by saving initial state
Nobody has claimed this yet.
- Dominant language
- ReScript
- Stars
- 354
- Forks
- 63
- Avg merge
- 11h 29m
- Merged PRs (30d)
- 1
Description
Every time any editor command is invoked, the analysis starts from scratch. Find and read bsconfig.json, scan project files, etc.
Then executing the actual command is typically little work (exception: command to find all the references).
See for example:
https://github.com/rescript-lang/rescript-vscode/blob/master/analysis/tests/src/expected/Debug.res.txt
There's an opportunity for reducing latency by caching the initial state of the project before executing the specific command.
However, even though technically this is a clear opportunity for speedup, latency has in practice not been an issue in existing projects. So this note is just about some design ideas, but there's no action plan at the moment, as there is no need.
Anyhow, one could save the state after project initialisation, in a special marshalled file. And if that file exists, one can quickly read that marshalled file. Care is required to consider all the inputs to that file (for example, if bsconfig.json or any other input changes). Plus, one needs to check that if a .cmt on disk has changed (probably via timestamp), that the new version is loaded. Such a mechanism was there until recently, so it's about checking that it still works.
Finally, there's the question of when to update the file with the marshalled state on disk.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the example at analysis/tests/src/expected/Debug.res.txt and reviewing the issue's description of project initialization and the previous marshalled-state mechanism. Determine the inputs and update conditions that would need to be covered; the issue does not define an implementation plan or a clear done condition.
Written by the indexing model from the issue text.
Assessment
- Domain
- devtools, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100