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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: emit_assets only emit changed assets #3305

Merged
merged 1 commit into from
May 29, 2023
Merged

Conversation

jerrykingxyz
Copy link
Collaborator

@jerrykingxyz jerrykingxyz commented May 25, 2023

Related issue (if exists)

Before
image

After
image

Summary

馃 Generated by Copilot at bb1ef0f

This pull request implements a feature that allows the compiler to only emit changed assets, except for the hot module replacement assets, which are always emitted. This can improve the performance and efficiency of the compilation process. To achieve this, the pull request adds a version field to the Asset and CompilationAsset structs, which stores the content hash of the asset. It also adds and implements a remove_file method to the AsyncFileSystem trait and its concrete implementations, which enables the compiler to delete outdated assets from the output directory. Additionally, it modifies the OutputOptions and DevtoolPlugin structs to set the version field of the asset info variables accordingly.

Walkthrough

馃 Generated by Copilot at bb1ef0f

  • Add a new feature that allows the compiler to only emit changed assets by comparing the content hash of the assets (link, link, link, link, link, link, link, link, link, link)
  • Add a new method remove_file to the AsyncFileSystem trait and implement it for the NativeFileSystem and NodeFileSystem structs using the tokio::fs::remove_file and fs.unlinkSync functions respectively (link, link, link, link, link, link, link, link)
  • Add a mut modifier and a default value assignment to the asset variable in the for loop in crates/rspack_core/src/compiler/hmr.rs to ensure that the hot module replacement assets are always emitted (link, link)

@github-actions github-actions bot added release: performance team The issue/pr is created by the member of Rspack. labels May 25, 2023
@jerrykingxyz jerrykingxyz linked an issue May 25, 2023 that may be closed by this pull request
@faga295
Copy link
Contributor

faga295 commented May 28, 2023

Hey @jerrykingxyz , I wonder how this graph in your description was generated, this look useful

image

Copy link
Collaborator

@ahabhgk ahabhgk left a comment

Choose a reason for hiding this comment

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

The general overview looks good to me, I like the version concept, good job 馃憤

crates/rspack_core/src/compiler/hmr.rs Outdated Show resolved Hide resolved
@jerrykingxyz
Copy link
Collaborator Author

jerrykingxyz commented May 29, 2023

Hey @jerrykingxyz , I wonder how this graph in your description was generated, this look useful

image

@faga295 https://web-infra-dev.github.io/rspack-dev-guide/profiling/intro.html#chrome

@jerrykingxyz jerrykingxyz added this pull request to the merge queue May 29, 2023
Merged via the queue into main with commit ed3eeef May 29, 2023
12 checks passed
@jerrykingxyz jerrykingxyz deleted the jerry/emit_assets branch May 29, 2023 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support incremental rebuild when emit assets
3 participants