Tracking issue: compile cache
Offen
Dieses Issue hat noch niemand übernommen.
esm
module
never-stale
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
Follow up to https://github.com/nodejs/node/issues/47472 . Some items that can be investigated:
- Initial implementation, enabled via
NODE_COMPILE_CACHEenvironment variable: https://github.com/nodejs/node/pull/52535 - Exposing an API for user code to control the caching https://github.com/nodejs/node/pull/54501
- An API for flushing the cache: https://github.com/nodejs/node/pull/54971
- Support relative/portable cache: https://github.com/nodejs/node/pull/58797
- Embedder API for configuring the storage
- Support reading a list of files to generate cache ahead of time: https://github.com/nodejs/node/issues/58482
- Idle-time cache serialization like what Blink does, to avoid penalizing the first load
- Other hashing algorithm (CRC32 may be good enough for our use case. In the initial implementation, it was chosen because it can be used on no-crypto builds and fast enough. For reference, ccache has used md4 and later BLAKE2b -> BLAKE3)
- Other directory layout (splitting the cache for each file and read on the fly seems to be fast enough and I don't really see I/O showing up in the profile anyway) or using a db (if/when we implement Web Storage?)
- Inode caching like https://github.com/ccache/ccache/pull/577 (note that CRC32 also barely shows up in the profile, it may not worth the complexity).
- Avoid UTF8 transcoding by directly reading the source code as buffer from disk (this needs to dance with CJS loader monkey patching)
- Move the flushing operations off-thread so that they can be done as soon as the code cache is ready and can be done concurrently https://github.com/joyeecheung/node/tree/parallel-compile-cache (this likely tanks the performance for simpler use cases)
- Implement TS -> JS caching https://github.com/nodejs/node/issues/54741
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem verknüpften Folge-Issue 47472 und den nicht abgehakten compile-cache-Elementen in diesem Tracking-Issue. Wähle eine konkrete Untersuchung, etwa die embedder API oder die Ahead-of-time-Cache-Generierung, und ermittle dann die relevanten Node.js-Einstiegspunkte und Tests, bevor du den Abschluss für dieses Element definierst. Das Issue enthält derzeit keinen Datei- oder Testpfad, daher muss der Scope zuerst festgelegt werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, node.js, typescript
- Bereich
- performance, tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Aktiv
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 35/100