Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Do not re-hash installed wheels. #1534

Merged
merged 1 commit into from
Dec 14, 2021
Merged

Conversation

jsirois
Copy link
Member

@jsirois jsirois commented Dec 14, 2021

Previously, installed wheels were re-hashed when adding them to a PEX.
This was wasted time and effort that showed up particularly strongly
when building a large PEX that used a fast --pex-repository resolve.

Fixes #1533

Previously, installed wheels were re-hashed when adding them to a PEX.
This was wasted time and effort that showed up particularly strongly
when building a large PEX that used a fast --pex-repository resolve.
@jsirois
Copy link
Member Author

jsirois commented Dec 14, 2021

This is all just threading through pre-existing data to the right places.

The test case involves a 405M repository.pex / maximal-subset.pex and goes from:

$ time python3.8 -mpex -r ../requirements-perf/pants-requirements.txt --constraint ../requirements-perf/pants-requirements.txt --pex-repository repository.pex --layout packed -o maximal-subset.pex
Saving PEX file to maximal-subset.pex

real	0m4.106s
user	0m3.721s
sys	0m0.377s

To:

$ time python3.8 -mpex -r ../requirements-perf/pants-requirements.txt --constraint ../requirements-perf/pants-requirements.txt --pex-repository repository.pex --layout packed -o maximal-subset.pex
Saving PEX file to maximal-subset.pex

real	0m2.009s
user	0m1.974s
sys	0m0.035s

@@ -597,7 +597,9 @@ def build_pex(
)

for installed_dist in result.installed_distributions:
pex_builder.add_distribution(installed_dist.distribution)
pex_builder.add_distribution(
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the change that saves 2s in the example.

Copy link

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks!

@jsirois jsirois merged commit f1da401 into pex-tool:main Dec 14, 2021
@jsirois jsirois deleted the subset/faster branch December 14, 2021 19:53
@jsirois jsirois mentioned this pull request Dec 14, 2021
3 tasks
@stuhood stuhood mentioned this pull request Dec 22, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PEXBuilder.add_distribution re-hashes installed wheel distributions.
2 participants