-
Notifications
You must be signed in to change notification settings - Fork 309
Install files in parallel #1256
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/vcpkg/commands.install.cpp
Outdated
fs.remove_all(target, IgnoreErrors{}); | ||
fs.remove(target, IgnoreErrors{}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no difference for regular files between remove_all
and remove
(provided that vcpkg's implementation is identical to the STL): https://en.cppreference.com/w/cpp/filesystem/remove
…/vcpkg-tool into parallel-file-install
@BillyONeal Unit tests on OSX failed here. It seems to work again but I can consistently reproduce the failure on my local machine: The test case |
Btw you can build the format target locally to format all code. |
Sorry! |
I think the main issue with parallelizing here is printing. Basically, whenever the program can print anything, needs to be guarded by a mutex which is IMO not possible from the outside. Therefore, we need to make printing inherently thread safe. |
This comment was marked as outdated.
This comment was marked as outdated.
@BillyONeal I addressed your concerns regarding conflicting directory creations and interleaved terminal output. I changed the code to write the list file from the main thread and I use a mutex to protect terminal output. |
My profiling showed that this PR makes
install_files_and_write_listfile()
2x faster (tested with catch2 (39.8/ 24.5 ms) & aws-c-common (21.7/ 11.9 ms) on M2 MacBook Air). However, previous tests on Windows indicated even higher speedups (>= 4x).Previous behavior
For each installed file individuall, the file type was btained and checked and the file was copied to the installed folder. At the same time, the file path was added to a vector containing a list of all installed files.
The listfile was created using
fs.write_lines()
.fs.write_lines()
results in onewrite()
and oneput()
(for\n
) for each line.Current behavior
fs.write_contents_and_dirs()
.