Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch RcStr from std::sync::Arc to triomphe::Arc (vercel/turborepo#8715
) # Description This removes the weakref from each `Arc`, which we weren't using, saving 64 bits per unique `RcStr`. https://docs.rs/triomphe/latest/triomphe/struct.Arc.html The difference in memory is too small to easily measure with heaptrack, but it should be a small win regardless, and it's a drop-in replacement that doesn't make the code any more complicated. # Testing Instructions Built using ``` cargo build --release -p next-build-test ``` Ran heaptrack on a single page (`/sink`) in `shadcn/ui` with: ``` cd ~/ui/apps/www RUST_LOG=next_build_test=info heaptrack ~/nextpack/target/release/next-build-test run sequential 1 1 '/sink' ``` And analyzed the results with ``` heaptrack --analyze /home/bgw.linux/ui/apps/www/heaptrack.next-build-test.3066837.zst | tail -100 ``` ## Heaptrack Before PR ``` total runtime: 135.14s. calls to allocation functions: 49700807 (367770/s) temporary memory allocations: 4126130 (30532/s) peak heap memory consumption: 1.18G peak RSS (including heaptrack overhead): 2.76G total memory leaked: 11.93M suppressed leaks: 7.24K ``` ``` total runtime: 138.50s. calls to allocation functions: 49771465 (359355/s) temporary memory allocations: 4410274 (31842/s) peak heap memory consumption: 1.18G peak RSS (including heaptrack overhead): 2.75G total memory leaked: 12.09M suppressed leaks: 7.24K ``` ## Heaptrack After PR ``` total runtime: 145.38s. calls to allocation functions: 49714711 (341966/s) temporary memory allocations: 4164393 (28645/s) peak heap memory consumption: 1.18G peak RSS (including heaptrack overhead): 2.75G total memory leaked: 11.67M suppressed leaks: 7.24K ``` ``` total runtime: 128.03s. calls to allocation functions: 49739679 (388515/s) temporary memory allocations: 4111893 (32117/s) peak heap memory consumption: 1.18G peak RSS (including heaptrack overhead): 2.76G total memory leaked: 11.88M suppressed leaks: 7.24K ```
- Loading branch information