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

Support uncompressed PEXes. #1705

Merged
merged 1 commit into from
Apr 5, 2022
Merged

Support uncompressed PEXes. #1705

merged 1 commit into from
Apr 5, 2022

Conversation

jsirois
Copy link
Member

@jsirois jsirois commented Apr 4, 2022

Closes #1686

@jsirois
Copy link
Member Author

jsirois commented Apr 4, 2022

The motivating case from #1675:

$ time python3.8 -mpex -v -r lock.txt -o compressed.pex
...
pex:       Installing 135 distributions: 3053.3ms
pex:       Checking install: 535.2ms
Saving PEX file to compressed.pex
pex: Zipping PEX file.: 125816.6ms

real	2m44.588s
user	2m23.503s
sys	0m6.389s

$ time python3.8 -mpex -v -r lock.txt -o un-compressed.pex --no-compress
pex:       Installing 135 distributions: 2970.2ms
pex:       Checking install: 531.3ms
Saving PEX file to un-compressed.pex
pex: Zipping PEX file.: 5055.3ms

real	0m43.521s
user	0m22.528s
sys	0m6.339s

$ ls -lh compressed.pex un-compressed.pex 
-rwxr-xr-x 1 jsirois jsirois 1.8G Apr  4 13:04 compressed.pex
-rwxr-xr-x 1 jsirois jsirois 3.8G Apr  4 13:05 un-compressed.pex

$ time python3.8 -mpex -v --pex-repository compressed.pex -r subset.txt -o compressed.subset.pex
pex: Building pex: 763.9ms                                                                                                                                                                                                                                      
pex:   Resolving distributions (subset.txt): 763.7ms
pex:     Resolving requirements from PEX compressed.pex.: 761.8ms
pex:       Laying out PEX zipfile compressed.pex: 119.5ms
pex:         Installing compressed.pex to /home/jsirois/.pex/unzipped_pexes/8b433f67c641a262e86ed13ea8db9e27743c9094: 119.3ms
Saving PEX file to compressed.subset.pex
pex: Zipping PEX file.: 120682.5ms

real	2m1.633s
user	1m59.387s
sys	0m2.131s

$ time python3.8 -mpex -v --pex-repository un-compressed.pex -r subset.txt -o un-compressed.subset.pex --no-compress
pex: Building pex: 666.1ms                                                                                                                                 
pex:   Resolving distributions (subset.txt): 665.9ms
pex:     Resolving requirements from PEX un-compressed.pex.: 663.8ms
pex:       Laying out PEX zipfile un-compressed.pex: 0.1ms
Saving PEX file to un-compressed.subset.pex
Previous binary unexpectedly exists, cleaning: un-compressed.subset.pex~
pex: Zipping PEX file.: 5242.6ms

real	0m6.096s
user	0m2.921s
sys	0m2.517s

$ ls -lh compressed.subset.pex un-compressed.subset.pex 
-rwxr-xr-x 1 jsirois jsirois 1.8G Apr  4 13:09 compressed.subset.pex
-rwxr-xr-x 1 jsirois jsirois 3.7G Apr  4 13:10 un-compressed.subset.pex

Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

If Pants didn't exist, would you still want to land this? I don't think Pants is very likely to use this now that we have Pex lock files and direct subsetting working, w/o need for repository pex

@jsirois
Copy link
Member Author

jsirois commented Apr 4, 2022

If Pants didn't exist, would you still want to land this?

Yes. And, so you know, my considerations always are for Pex as a standalone tool. It pre-dates Pants. If I add a feature for Pants only, or even have to consider Pants much, I generally consider that a bad sign.

So, I got wind via a Pants user / issue, but this is a totally sensible thing for any zipapp implementation - since zip! As a comparison point, shiv supports this.

@jsirois jsirois merged commit aa7bb8a into pex-tool:main Apr 5, 2022
@jsirois jsirois deleted the issues/1686 branch April 5, 2022 00:03
@stuhood
Copy link

stuhood commented Apr 5, 2022

If Pants didn't exist, would you still want to land this? I don't think Pants is very likely to use this now that we have Pex lock files and direct subsetting working, w/o need for repository pex

We'll still want to use the packed layout when building subsets from a lockfile... although whether skipping compression will make sense for our usecase will require benchmarking.

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.

Expose compression control for Pex zipping operations.
3 participants