diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2014-12-07 02:44:00 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-12-07 02:44:00 +0300 |
commit | b4c11c139717729b8257ee9382d4e5ed713d4dde (patch) | |
tree | 0b6c5edd491090c54b09657ef63c711a118a4e9d /archival/tar.c | |
parent | e7800f351ad9eca012fe27a1c9234692a04419e7 (diff) |
libarchive: add capability to unpack to mem.buffer
The performance and number of processes for a "depmod -a" with gzipped
modules was abysmal. This patch adds a code path without fork,
benefiting all users of xmalloc_open_zipped_read_close.
"modinfo radeon.ko.gz", a single-file reader, got 30% faster.
"depmod -a", which used to fork over 800 times, got 20% faster.
Heavily based on a patch by Lauri Kasanen <curaga@operamail.com>
function old new delta
setup_transformer_on_fd - 159 +159
transformer_write - 122 +122
fork_transformer - 112 +112
xmalloc_open_zipped_read_close 63 118 +55
read_bunzip 1866 1896 +30
xtransformer_write - 19 +19
unzip_main 2449 2462 +13
bbunpack 755 766 +11
unpack_lzma_stream 2717 2723 +6
unpack_xz_stream 2393 2397 +4
unpack_Z_stream 1173 1175 +2
inflate_unzip 111 105 -6
check_signature16 70 63 -7
unpack_bz2_stream 359 349 -10
unpack_unxz 12 - -12
unpack_unlzma 12 - -12
unpack_uncompress 12 - -12
unpack_gunzip 12 - -12
unpack_bunzip2 12 - -12
open_transformer 106 92 -14
inflate_unzip_internal 1945 1916 -29
unpack_gz_stream 693 655 -38
open_zipped 89 47 -42
setup_unzip_on_fd 142 53 -89
------------------------------------------------------------------------------
(add/remove: 4/5 grow/shrink: 7/8 up/down: 533/-295) Total: 238 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/tar.c')
-rw-r--r-- | archival/tar.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/archival/tar.c b/archival/tar.c index 7897a4af6..5bd473aac 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -1171,7 +1171,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv) } if (opt & OPT_ANY_COMPRESS) { - USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_state_t *xstate, int src_fd, int dst_fd);) + USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_state_t *xstate);) USE_FOR_NOMMU(const char *xformer_prog;) if (opt & OPT_COMPRESS) @@ -1190,7 +1190,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv) USE_FOR_MMU(xformer = unpack_xz_stream;) USE_FOR_NOMMU(xformer_prog = "unxz";) - open_transformer_with_sig(tar_handle->src_fd, xformer, xformer_prog); + fork_transformer_with_sig(tar_handle->src_fd, xformer, xformer_prog); /* Can't lseek over pipes */ tar_handle->seek = seek_by_read; /*tar_handle->offset = 0; - already is */ |