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

Parallel module install #3907

Closed
wants to merge 2 commits into from
Closed

Parallel module install #3907

wants to merge 2 commits into from

Conversation

lizmat
Copy link
Contributor

@lizmat lizmat commented Sep 7, 2020

An attempt at parallelizing module installation, now that a blocking race condition has been fixed by nine.

- use binding where possible, ensures no changes and save allocations
- fix indentation on protect block / localization dynvar blocks
- remove unnecessary intermediate variables
- rename $lock to $repo-lock, to prevent confusion with $!lock
- remove unnecessary "is copy" in signatures
- remove unneccssary .IO on already IO::Path objects
- only sort %provides once, work using keys from there on
- replace .values[0] with .values.head to prevent unnecessary caching
- some code re-ordering to prevent unnecessary work if next fires
Basically run the precomp in a start block, collect the promises
and await them.  Results for installation of core modules is meagre.
Installing something like App::Mi6 goes from 18 -> 15 seconds
wallclock.  Which is...  disappointing.  I wonder why this doesn't
improve more.
@lizmat lizmat marked this pull request as draft September 7, 2020 11:05
?? $repo-prefix ~ $source.relative($.prefix)
!! $source;

@promises.push: start {
Copy link
Member

Choose a reason for hiding this comment

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

Spawning a process for every module listed under provides is going to reach diminishing returns pretty quickly.

@niner
Copy link
Collaborator

niner commented Sep 8, 2020 via email

@vrurg
Copy link
Member

vrurg commented Sep 8, 2020

I did not follow the whole story of parallelizing precomps and may miss a thing. But how hard would it be to make it a task queue based processing? So that limited number of worker threads are pre-spawned and each would pick a task from a channel?

@ugexe
Copy link
Member

ugexe commented Sep 8, 2020

I did not follow the whole story of parallelizing precomps and may miss a thing. But how hard would it be to make it a task queue based processing? So that limited number of worker threads are pre-spawned and each would pick a task from a channel?

Precompilation currently spawns a new process and thus requires IPC

@lizmat
Copy link
Contributor Author

lizmat commented Jan 4, 2022

Closing this now, as it appears we should be able to solve slow installation better with making sure we only precomp a module once in the installation process.

@lizmat lizmat closed this Jan 4, 2022
@lizmat lizmat deleted the parallel-module-install branch January 4, 2022 18:04
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.

None yet

4 participants