Skip to content
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

Improve Multi-threaded Performance. #450

Merged
merged 5 commits into from
Feb 21, 2023
Merged

Improve Multi-threaded Performance. #450

merged 5 commits into from
Feb 21, 2023

Conversation

PercentBoat4164
Copy link
Contributor

    The idea of this pull request is to improve the performance of CPM in multi-threaded conditions by removing the cpm_add_subdirectory() calls from the scope of the lock.

    Before this change, each instance of CMake must wait for each instance that gets hold of the lock before it to completely finish checking if the cache is clean, then adding the subdirectory. This can become a very long process for even moderately sized libraries.

    To solve this problem, I propose moving the file(LOCK ... RELEASE) command to just after the fetch has taken place, and adding another one right before checking if the cache is clean. This will allow the first process to stop all others during the download, then when it is unlocked, all processes can simultaneously check the cache (still only done by processes that did not perform the download) and add the new subdirectory.

    This will help alleviate, but will not fix #419.

Copy link
Member

@iboB iboB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me

@TheLartians TheLartians merged commit 0938e8f into cpm-cmake:master Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to skip cpm_check_git_working_dir_is_clean
3 participants