--- a/archival/libarchive/open_transformer.c
+++ b/archival/libarchive/open_transformer.c
@@ -213,6 +213,22 @@ void* FAST_FUNC xmalloc_open_zipped_read_close(const char 
*fname, size_t *maxsz_
        int fd;
        char *image;

+       /* Fast path for well-behaved gzip files, avoiding forks. */
+       if (ENABLE_FEATURE_SEAMLESS_GZ && ENABLE_DESKTOP && BB_MMU) {
+               uint16_t magic;
+               fd = open(fname, O_RDONLY);
+               xread(fd, &magic, 2);
+

are you sure that open will succeed at this place ?

re.
 wh


Am 27.11.2014 15:27, schrieb Lauri Kasanen:
> Hi,
> 
> The performance and number of processes for a "depmod -a" with gzipped
> modules was abysmal. This patch adds a fast path without fork for well-
> behaved gzip files, 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. And of
> course
> a whole lot less processes -> much saved RAM.
> 
> function                                             old     new   delta
> inflate_get_next_window                                -    1877   +1877
> xmalloc_unpack_gz                                      -     356    +356
> check_header_gzip                                      -     298    +298
> xmalloc_inflate_unzip_internal                         -     223    +223
> inflate_init                                           -      97     +97
> xmalloc_open_zipped_read_close                        73     159     +86
> inflate_store_unused                                   -      35     +35
> unpack_gz_stream                                     567     299    -268
> inflate_unzip_internal                              2304     172   -2132
> ------------------------------------------------------------------------------
> (add/remove: 6/0 grow/shrink: 1/2 up/down: 2972/-2400)        Total: 572
> bytes
> 
> --
> 
> It's currently guarded by CONFIG_DESKTOP. If you'd like a new config
> option instead, please say so.
> 
> - Lauri
> 
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to