Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(@angular/build): add persistent caching of JavaScript transformations #27635

Merged
merged 2 commits into from
May 14, 2024

Conversation

clydin
Copy link
Member

@clydin clydin commented May 13, 2024

When caching is enabled for the Angular CLI, the JavaScript transformer within the application build system will now perform persistent caching of its output. This allows for improved warm build times by removing the need to run the Angular linker and build optimizer steps against unchanged third-party code within each build. This does not affect hot rebuilds that would take place during watch mode since the outputs are already cached within memory. The on-disk storage of the cached data is handled by the lmdb package which provides fast key/value storage and built-in off-thread compression. This package is currently used by such projects as Gatsby and parcel for their respective caching subsystems.

Warm production build of a new 18.0.0-rc.2 project with disabled caching:

Application bundle generation complete. [3.698 seconds]

With enabled caching:

Application bundle generation complete. [2.277 seconds]

@clydin clydin changed the title perf(@angular-devkit/build-angular): add persistent caching of JavaScript transformations perf(@angular/build): add persistent caching of JavaScript transformations May 13, 2024
@clydin clydin force-pushed the esbuild/js-transform-file-cache branch 4 times, most recently from 78d4b1b to 0c3cbe8 Compare May 13, 2024 16:48
…tions

When caching is enabled for the Angular CLI, the JavaScript transformer
within the application build system will now perform persistent caching
of its output. This allows for improved warm build times by removing the
need to run the Angular linker and build optimizer steps against unchanged
third-party code within each build. This does not affect hot rebuilds that
would take place during watch mode since the outputs are already cached
within memory. The on-disk storage of the cached data is handled by the
`lmdb` package which provides fast key/value storage and built-in off-thread
compression. This package is currently used by such projects as Gatsby and
parcel for their respective caching subsystems.

Warm production build of a new 18.0.0-rc.2 project with disabled caching:
```
Application bundle generation complete. [3.698 seconds]
```
With enabled caching:
```
Application bundle generation complete. [2.277 seconds]
```
@clydin clydin force-pushed the esbuild/js-transform-file-cache branch from 0c3cbe8 to 1fa3ba0 Compare May 13, 2024 16:51
@clydin clydin added the target: rc This PR is targeted for the next release-candidate label May 13, 2024
@clydin clydin marked this pull request as ready for review May 13, 2024 17:06
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label May 13, 2024
@clydin clydin requested a review from alan-agius4 May 13, 2024 17:06
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels May 14, 2024
@alan-agius4 alan-agius4 merged commit d74258a into angular:main May 14, 2024
36 checks passed
@clydin clydin deleted the esbuild/js-transform-file-cache branch May 14, 2024 10:52
let cacheStore;
if (pluginOptions.sourceFileCache?.persistentCachePath) {
cacheStore = new LmbdCacheStore(
pluginOptions.sourceFileCache.persistentCachePath + '/angular-compiler.db',
Copy link

@sod sod May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess to make the windows users happy, this could be:

path.join(pluginOptions.sourceFileCache.persistentCachePath, 'angular-compiler.db')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows actually supports both path separators; but, yes it could.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker target: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement build caching support in esbuild-based browser application builder
3 participants