From: Pavel Machek <pavel@ucw.cz>
To: Nigel Cunningham <ncunningham@cyclades.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: LZF Cryptoapi support.
Date: Tue, 19 Jul 2005 15:54:41 +0200 [thread overview]
Message-ID: <20050719135441.GB2410@elf.ucw.cz> (raw)
In-Reply-To: <1121657429.13487.41.camel@localhost>
Hi!
> Here's another resend, this time adding an lzf cryptoapi module.
>
> LZF is a very fast compressor which typically achieves approximately 50%
> compression on a suspend image. The original author (Marc Alexander
> Lehmann) donated it to Suspend2. I have converted it to cryptoapi with a
> recent switch of Suspend2 to use cryptoapi.
And it is still that old, ugly code.
> +/*
> + * sacrifice some compression quality in favour of compression speed.
> + * (roughly 1-2% worse compression for large blocks and
> + * 9-10% for small, redundant, blocks and >>20% better speed in both cases)
> + * In short: enable this for binary data, disable this for text data.
> + */
> +#define ULTRA_FAST 1
> +
> +#define STRICT_ALIGN 0
> +#define USE_MEMCPY 1
> +#define INIT_HTAB 0
We do not want these options. It also allows you to kill ifdefs down
in the code.
> +#define HSIZE (1 << (HLOG))
> +
> +/*
> + * don't play with this unless you benchmark!
> + * decompression is not dependent on the hash function
> + * the hashing function might seem strange, just believe me
> + * it works ;)
> + */
> +#define FRST(p) (((p[0]) << 8) + p[1])
> +#define NEXT(v,p) (((v) << 8) + p[2])
> +#define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) + h*3) & (HSIZE - 1))
> +/*
> + * IDX works because it is very similar to a multiplicative hash, e.g.
> + * (h * 57321 >> (3*8 - HLOG))
> + * the next one is also quite good, albeit slow ;)
> + * (int)(cos(h & 0xffffff) * 1e6)
> + */
> +
> +#if 0
> +/* original lzv-like hash function */
> +# define FRST(p) (p[0] << 5) ^ p[1]
> +# define NEXT(v,p) ((v) << 5) ^ p[2]
> +# define IDX(h) ((h) & (HSIZE - 1))
> +#endif
And we do not want #if 0-ed code.
Pavel
--
teflon -- maybe it is a trademark, but it should not be.
next prev parent reply other threads:[~2005-07-19 13:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-18 3:30 Nigel Cunningham
2005-07-19 13:54 ` Pavel Machek [this message]
2005-07-21 4:56 ` Nigel Cunningham
2005-07-21 5:29 ` Pavel Machek
2005-07-31 3:56 ` Herbert Xu
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=20050719135441.GB2410@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=ncunningham@cyclades.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®