| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…er worker Previously, callSite.expressions.map((_, index) => index) was evaluated on every $localize call site for every locale inside inlineLocalize. In bundles with hundreds of call sites processed across multiple locales in a batch, this resulted in thousands of redundant small array allocations. expressionIndexes is now precomputed once during AST extraction in extractLocalizeMetadata and stored on LocalizeCallSite, eliminating per-locale index array allocations in the worker transformation loop.
…tch loop Instantiate codeBlob and mapBlob once per file outside the batch loop instead of re-creating new Blob instances on each batch slice. Blobs are immutable, read-only binary handles and can be safely shared across multiple worker batch tasks concurrently.
…nliner Streamline the asynchronous cache resolution in inlineAll by removing the intermediate CacheCheckItem interface and array mapping allocations. Results are now assigned directly to fileResultsByLocale on hit or pushed to uncachedByFile on miss. When no persistent cache is configured, a fast path directly queues uncached files without promise or hash overhead.
…ing in i18n inliner Introduce generation tracking in I18nInliner and worker batch tasks to guarantee long-term worker caches (fileDataCache and deserializedTranslations) are wiped whenever a new inlining pass or rebuild begins (e.g. watch mode or shared worker pools).
…n i18n inliner worker
Consolidate the 3 chained string replacement passes (unescaping double quotes,
escaping backticks, and escaping ${ delimiters) into a single regex pass in
escapeTemplatePart. This eliminates 3 intermediate string allocations and
reduces 3 regex scans to 1 on every translated template literal part.
There was a problem hiding this comment.
This pull request introduces a generation counter to clear long-term worker caches across multiple runs of the i18n inliner, ensuring correctness in watch mode. It also refactors template literal escaping into a single-pass helper function and optimizes cache-checking logic. Feedback on the changes highlights that the new asynchronous cache-checking logic introduces non-determinism in the order of uncached file entries due to varying cache lookup resolution times. A deterministic approach using per-file Promise.all is suggested to ensure build reproducibility and ease debugging.
Sorry, something went wrong.
…he checks Resolve asynchronous cache checks on a per-file basis using Promise.all to ensure windowLocales ordering is preserved within uncachedByFile regardless of disk I/O resolution timing. Also avoids pre-populating and deleting empty arrays in uncachedByFile.
| Back | FazBrowse Home | New Git URL |
This PR introduces a series of focused optimizations to reduce heap allocations, streamline cache pipeline resolution, and ensure clean worker memory lifecycle in the I18nInliner.