[BusyBox 0004944]: patch to support lzop compression/decompression

bugs at busybox.net bugs at busybox.net
Sat Sep 27 19:17:34 UTC 2008


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=4944 
====================================================================== 
Reported By:                Alain137
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   4944
Category:                   New Features
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             09-13-2008 00:54 PDT
Last Modified:              09-27-2008 12:17 PDT
====================================================================== 
Summary:                    patch to support lzop compression/decompression
Description: 
This is a patch to add the lzop compressor/decompressor to busybox.
Lzop is a compressor that is more than twice as fast as gzip at its
fastest setting, and is thus useful in any application where
compression/decompression speed is more important than ratio. For
instance, I use lzop with udcpast to speed up network transfers (gzip
would actually make the transfer slower, as any time gain obtained due to
having less data to transfer would be lost due to the time it takes to
compress)

Compression:

> time lzop -c /usr/bin/mplayer >/dev/null
lzop -c /usr/bin/mplayer > /dev/null  0,33s user 0,01s system 100% cpu
0,337 total
> time gzip -1 -c /usr/bin/mplayer >/dev/null
gzip -1 -c /usr/bin/mplayer > /dev/null  0,80s user 0,03s system 94% cpu
0,882 total


Decompression:
> time gzip -dc  mplayer.gz >/dev/null
gzip -dc mplayer.gz > /dev/null  0,27s user 0,01s system 97% cpu 0,288
total
> time lzop -dc mplayer.lzo >/dev/null
lzop -dc mplayer.lzo > /dev/null  0,10s user 0,01s system 100% cpu 0,112
total


For building it, a liblzo2 static library must be present on the system
(for example, liblzo2-dev on a Kubuntu system)

====================================================================== 

---------------------------------------------------------------------- 
 vda - 09-20-08 07:56  
---------------------------------------------------------------------- 
The patch seems to contain only the glue needed to interface with LZO
library. It does not contain LZO compression code itself. The "innermost"
routines are lzo_compress() and lzo_decompress() but from there they just
call into liblzo2 (lzo1x_1_15_compress() etc).

And this glue code is big. I mean, it's VERY BIG.

For comparison: look into bbunzip.c, unlzma glue code is less than one
screensful:

static char* make_new_name_unlzma(char *filename)
{
        return make_new_name_generic(filename, "lzma");
}
static USE_DESKTOP(long long) int unpack_unlzma(void)
{
        return unpack_lzma_stream(STDIN_FILENO, STDOUT_FILENO);
}
int unlzma_main(int argc UNUSED_PARAM, char **argv)
{
        getopt32(argv, "cf");
        argv += optind;
        /* lzmacat? */
        if (applet_name[4] == 'c')
                option_mask32 |= OPT_STDOUT;
        return bbunpack(argv, make_new_name_unlzma, unpack_unlzma);
}

lzop glue code should be just added to this file in a similar way.

 

---------------------------------------------------------------------- 
 Alain137 - 09-23-08 22:30  
---------------------------------------------------------------------- 
Well, part of the problem is that the LZO library (apparently?) only
handles the actual compressed data, but not the header. So, header
handling is left to the application (glue) 

---------------------------------------------------------------------- 
 bernhardf - 09-24-08 00:21  
---------------------------------------------------------------------- 
I would strongly suggest to make sure that we can use minilzo instead of
the rather big "normal" lzo.

For reference:
http://repo.or.cz/w/buildroot.git?a=blob_plain;f=package/lzo_mini/lzo_mini.mk;hb=HEAD


---------------------------------------------------------------------- 
 vda - 09-24-08 03:54  
---------------------------------------------------------------------- 
I'm not against glue code itself. I am just saying it is way, way too big.

I understand that you will need the code like lzo_compress() and
lzo_decompress() functions to handle .lzo data format and interface it
with LZO library, but they are not big. The rest of 100k+ code in this
patch is not needed.

Start by adding .lzo handling to bbunzip.c which calls not-yet-existing
unpack_lzo_stream(), then implement that one by taking only those parts of
lzo code that you need. I bet this way it will be much smaller. 

---------------------------------------------------------------------- 
 Alain137 - 09-27-08 12:17  
---------------------------------------------------------------------- 
I've made a new version (see attachment), which is much smaller: 36899
bytes of source, rather than 178272.

I admit, 36899 is still big (for just glue code), but unfortunately, the
lzop library is rather barebones, and _only_ supplies (de)compression of
one block, and not much else. Interpretation of headers, chaining of
blocks, calculation of checksums need all to be managed by the
application. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
09-13-08 00:54  Alain137       New Issue                                    
09-13-08 00:54  Alain137       Status                   new => assigned     
09-13-08 00:54  Alain137       Assigned To               => BusyBox         
09-13-08 00:54  Alain137       File Added: lzop.diff                        
09-20-08 07:54  vda            Note Added: 0011714                          
09-20-08 07:56  vda            Note Edited: 0011714                         
09-23-08 22:30  Alain137       Note Added: 0011824                          
09-24-08 00:21  bernhardf      Note Added: 0011834                          
09-24-08 03:54  vda            Note Added: 0011844                          
09-27-08 12:11  Alain137       File Added: busybox-1.12.0-lzop.patch            
       
09-27-08 12:17  Alain137       Note Added: 0012284                          
======================================================================




More information about the busybox-cvs mailing list