rescript-lang / rescript-lang/rescript-vscode

Design: reduce latency by saving initial state

Offen
#280 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

enhancement
Vorherrschende Sprache
ReScript
Sterne
354
Forks
63
Ø Merge
11 Std. 29 Min.
Gemergte PRs (30 T.)
1

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das Beispiel unter analysis/tests/src/expected/Debug.res.txt zu lesen und die Beschreibung des Issues zur Projektinitialisierung sowie den vorherigen Mechanismus für den marshalled state zu prüfen. Ermittle die Eingaben und Aktualisierungsbedingungen, die abgedeckt werden müssten; der Issue definiert weder einen Implementierungsplan noch eine klare Abschlussbedingung.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Bereich
devtools, performance
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
20/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.