All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Javier Martín" <lordhabbit@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [RFC] split floppy support off biosdisk
Date: Wed, 18 Jun 2008 13:40:26 +0200	[thread overview]
Message-ID: <1213789226.7112.29.camel@localhost> (raw)
In-Reply-To: <1213760967.2940.8.camel@rd>

[-- Attachment #1: Type: text/plain, Size: 3559 bytes --]

El mar, 17-06-2008 a las 23:49 -0400, Pavel Roskin escribió:
> On Wed, 2008-06-18 at 05:14 +0200, Javier Martín wrote:
> 
> > ORIGINAL FILE: /boot/grub/core.img (28449 bytes in Ubuntu Hardy default)
> 
> That's an already compressed file!  Please see my posts in the thread.
> We should be testing compression on the data we are actually
> compressing.
Yeah, I noticed it _after_ posting and sent another message to the
effect. I repeated the tests, now with an uncompressed image. For the
"scientific method" guys wanting to repeat or extend the test, this is
how the it was performed:

/boot/grub$ cat kernel.img pc.mod fshelp.mod ext2.mod > ~/core.img
/boot/grub$ cd
~$ stat -c %s core.img
40412	# Size of the uncompressed file (for later)
~$ for n in {1..9}; do
	lzop core.img -c -$n > ./core.$n.lzo
	gzip core.img -c -$n > ./core.$n.gz
	bzip2 core.img -c -k -$n > ./core.$n.bz2
	lzma core.img -c -k -$n > ./core.$n.lzma
done 
~$ for comp in lzo gz bz2 lzma; do
	echo $comp
	for n in {1..9}; do
		echo $(stat -c %s ./core.$n.$comp)-$(dc -e "2 k 100 $(stat -c %
s ./core.$n.$comp) 404.12 / - p")
	done
done

For me, the results are:

CL     LZO-%sav    GZIP-%sav   BZIP2-%sav    LZMA-%sav
 1   29391-27.3   24171-40.2   22979-43.2   21569-46.7
 2   29279-27.6   23913-40.9        x       21567-46.7
 3  *     x       23785-41.2        x       20922-48.3
 4        x       23350-42.3        x            x
 5        x       23148-42.8        x       20924-48.3
 6        x      *23074-43.0        x            x
 7   25250-37.6   23071-43.0        x      *     x
 8   25163-37.8   23045-43.0        x       20929-48.3
 9   25162-37.8   23035-43.0  *     x            x
Where:
* indicates the default compression level
x indicates "same as above"
The original file size was 40412 bytes

I hope the results are a bit more useful this time. The "uncompressed
chunk" of nearly 1KiB was not taken into account, i.e. the whole file
was compressed by every algorithm. My conclusions are:
* LZO is pretty bad unless we set the maximum compression level, which
is not a problem because required memory and CPU is still nearly zero.
Seemingly, grub-mkimage already compresses with high CLs because the
core.img it generated with the same parameters than my cat'ed test image
was 25928 bytes long, with the uncompressed part and the decompressor.
* GZip is okay in its default compression level of -6, but, as LZO, we
don't lose nearly anything in terms of CPU and memory by pushing it to
-9. The particular advantage of this algorithm is that is already
implemented for this same purpose in the Linux kernel, so may be we
could use copy-paste to some point and relieve us some work. We'd save
up to 2 KiB in my test image, assuming similar decompressor size.
* BZip2 is also fine - its results are immutable throughout the CLs, I
suppose because the whole file fits in its -1 compression dictionary of
100 KiB. I don't think we'd benefit a lot from this particular algorithm
with files this small, and thus I prefer GZip over it.
* LZMA is the king of compression, and so we gain more bytes for code,
but at the cost of an implementation of unknown size - the C version of
the decompressor in the coreboot project seemed to be a bit big, but
maybe our local assembly gurus could tune it down. We'd save up to 4 KiB
in my test image, assuming similar decompressor size.

I hope I did not make any embarrassing mistakes this time :-) 


[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 827 bytes --]

  parent reply	other threads:[~2008-06-18 11:40 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-15 17:48 [RFC] split floppy support off biosdisk Robert Millan
2008-06-16  0:32 ` Pavel Roskin
2008-06-16  6:30   ` Bean
2008-06-16  9:15     ` Robert Millan
2008-06-16 11:03       ` Bean
2008-06-16 11:20         ` Javier Martín
2008-06-16 11:47           ` Bean
2008-06-16 12:09             ` Javier Martín
2008-06-16 12:37               ` Bean
2008-06-16 21:31                 ` Robert Millan
2008-06-17  2:03                   ` Bean
2008-06-17  2:47                     ` Javier Martín
2008-06-17  3:06                       ` Bean
2008-06-17 14:39                         ` Javier Martín
2008-06-17 14:52                           ` Bean
2008-06-17 17:23                             ` Javier Martín
2008-06-17 17:35                               ` Bean
2008-06-18  3:14                                 ` Javier Martín
2008-06-18  3:49                                   ` Pavel Roskin
2008-06-18  6:55                                     ` Bean
2008-06-18  7:36                                       ` Pavel Roskin
2008-06-18  8:01                                         ` Bean
2008-06-18 11:29                                         ` Bean
2008-06-18 17:37                                       ` Robert Millan
2008-06-18 11:40                                     ` Javier Martín [this message]
2008-06-18 13:12                                       ` Bean
2008-06-18 13:28                                         ` Bean
2008-06-18 13:33                                         ` Javier Martín
2008-06-18 17:32                                           ` Isaac Dupree
2008-06-18 17:38                                             ` Robert Millan
2008-06-18  3:48                                 ` Javier Martín
2008-06-17 15:02                           ` Bean
2008-06-17 15:54                             ` Pavel Roskin
2008-06-18 17:53                               ` Yoshinori K. Okuji
2008-06-17 12:22                     ` Robert Millan
2008-06-17 12:33                       ` Robert Millan
2008-06-17 12:54                         ` Robert Millan
2008-06-18 17:52                           ` Yoshinori K. Okuji
2008-06-18 22:15                             ` Robert Millan
2008-06-18 23:56                               ` Pavel Roskin
2008-06-19  2:14                                 ` Yoshinori K. Okuji
2008-06-19  2:37                                   ` Pavel Roskin
2008-06-19 12:20                                     ` Robert Millan
2008-06-19 19:22                                       ` Pavel Roskin
2008-06-16 13:06               ` Pavel Roskin
2008-06-16 14:06                 ` Bean
2008-06-16 14:38                   ` Pavel Roskin
2008-06-16 21:13           ` Robert Millan
2008-06-16 21:12         ` Robert Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1213789226.7112.29.camel@localhost \
    --to=lordhabbit@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.