Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repo_path: avoid repeated copying of
PathBuf
in to_fs_path()
I've noticed `WorkspaceCommandHelper::format_file_path()` appear in profiles a few times. A big part of that is spent in `RepoPath::to_fs_path()`. I think I had been thinking that `PathBuf::join()` takes `self` by value and mutates it, but it turns out it creates a new instance. So our `result = result.join(...)` in a loop was copying the `PathBuf` over and over. This fixes that and also reserves the expected size. That speeds up `jj files --ignore-working-copy -r v6.0` in the Linux repo from 546.0 s to 509.3 s (6.7%).
- Loading branch information