diff options
author | merakor <cem@ckyln.com> | 2021-02-04 09:42:49 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2021-02-04 09:42:49 +0000 |
commit | 37d93c5413b1025c8490b57edf2dea821320d2ca (patch) | |
tree | e48f5214c88cb2c032b99cbbe0fa492b6d7e5a56 /lib.rc | |
parent | 492d8cca79b1cb392aa585bce2e269f40dba070a (diff) | |
download | cpt-37d93c5413b1025c8490b57edf2dea821320d2ca.tar.gz |
pkg_extract(): Add support for pax and add new methods
Even though we had a portable extraction method for tarballs, this slowed
down the extraction immensely. I have added 2 new methods for tarball
extraction so that we have faster extraction speeds based on the system
tar implementation. Here are the options with the order of preference:
- pax: Although an uncommon program, pax is defined by POSIX, and
supports regular expressions, meaning that we can 'strip' components.
This is slightly faster than bsdtar and GNU tar.
- bsdtar/gnutar: We simply use '--strip-components 1' for these tar
implementations.
- tar: This is the portable method we had been using for a while, it's
good, gets the job done, but it is slower.
Here is also a little benchmarking I did by extracting the Linux tarball
for 10 times per method.
tarball=$CPT_CACHE/sources/linux-headers/linux-5.10.12.tar.xz
for extract in pax bsdtar tar; do
time sh -c ". cpt-lib
extract=$extract
for i in \$(seq 10); do
mkdir -p hdr; cd hdr;
tar_extract \"$tarball\"; cd ..;
rm -rf hdr
done"
done
This yields the following output, methods are as ordered above:
sh -c 75.21s user 11.11s system 115% cpu 1:14.90 total
sh -c 78.68s user 14.64s system 124% cpu 1:15.15 total
sh -c 99.88s user 69.99s system 119% cpu 2:21.70 total
FossilOrigin-Name: 45e3a9a03e7eff9b30b0e911d68d44068e8681ebf4501f271c8a686118f29243
Diffstat (limited to 'lib.rc')
0 files changed, 0 insertions, 0 deletions