Tracking issue: compile cache
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 122k
- Forks
- 37.3k
- Merge moyen
- 4 j 2 h
- PR mergées (30 j)
- 283
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par l’issue de suivi liée 47472 et les éléments compile-cache non cochés de cette tracking issue. Choisissez une investigation précise, telle que l’embedder API ou la génération de cache ahead-of-time, puis identifiez les points d’entrée et les tests Node.js pertinents avant de définir les critères d’achèvement de cet élément. L’issue ne fournit actuellement aucun chemin de fichier ou de test ; le périmètre doit donc être établi en premier.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, node.js, typescript
- Domaine
- performance, tooling
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- Active
- Clarté
- À clarifier
- Accessibilité débutants
- 35/100