about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp
diff options
context:
space:
mode:
authorJoão M. Bezerra <marcospb19@hotmail.com>2023-06-27 01:05:48 -0300
committerJoão M. Bezerra <marcospb19@hotmail.com>2023-06-27 18:45:47 -0300
commit11f35d60163c659e2960f2749f7db732d3fc9000 (patch)
treecdfd9239531951ed763963d8dda2d564352c27dd /compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp
parent27e10c5292eee22abef69aed7144f80bdea00603 (diff)
downloadrust-11f35d60163c659e2960f2749f7db732d3fc9000.tar.gz
rust-11f35d60163c659e2960f2749f7db732d3fc9000.zip
std: remove an allocation in `Path::with_extension`
`Path::with_extension` used to reallocate (and copy) paths twice per
call, now it does it once, by checking the size of the previous and new
extensions it's possible to call `PathBuf::with_capacity` and pass the
exact capacity it takes.

Also reduce the memory consumption of the path returned from
`Path::with_extension` by using exact capacity instead of using
amortized exponential growth.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp')
0 files changed, 0 insertions, 0 deletions