refactor(@angular/build): use xxhash-wasm for fast non-cryptographic content hashing - #33798
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a faster, non-cryptographic 64-bit hashing mechanism using xxhash-wasm to replace Node's createHash('sha256') across various build tools, cache keys, and ETags. While this is a great performance improvement, the review highlights critical issues with the synchronous fallback in calculateHashSync, which introduces non-determinism and can break incremental compilation. Additionally, changing calculateGlobalStylesheetConfigHash to an asynchronous function requires updating all of its callers, and ensureXxhash should cache its initialization promise to prevent redundant WebAssembly compilations under high concurrency.
ccf4cdc to
ecfc614
Compare
…content hashing Replace OpenSSL SHA-256 with xxhash-wasm for internal non-cryptographic hashing across the build system. This includes JavaScript transformer cache keys, persistent load result disk caches, incremental TypeScript compiler source file versioning, i18n inlining cache keys, stylesheet compilation configuration hashes, and dev server asset ETags. By utilizing a 64-bit non-cryptographic hash backed by WebAssembly, hashing throughput is significantly increased while eliminating V8 OpenSSL C++ context allocations and garbage collection churn during cold and incremental builds.
ecfc614 to
9227e43
Compare
|
This PR was merged into the repository. The changes were merged into the following branches:
|
Replace OpenSSL SHA-256 with xxhash-wasm for internal non-cryptographic hashing across the build system. This includes JavaScript transformer cache keys, persistent load result disk caches, incremental TypeScript compiler source file versioning, i18n inlining cache keys, stylesheet compilation configuration hashes, and dev server asset ETags. By utilizing a 64-bit non-cryptographic hash backed by WebAssembly, hashing throughput is significantly increased while eliminating V8 OpenSSL C++ context allocations and garbage collection churn during cold and incremental builds.