From: Linus Torvalds <torvalds@osdl.org>
To: Joachim B Haga <cjhaga@fys.uio.no>
Cc: Nicolas Pitre <nico@cam.org>, Alex Riesen <raa.lkml@gmail.com>,
Junio C Hamano <junkio@cox.net>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] Make zlib compression level configurable, and change default.
Date: Mon, 3 Jul 2006 12:33:03 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0607031226370.12404@g5.osdl.org> (raw)
In-Reply-To: <85d5cm8qfn.fsf_-_@lupus.ig3.net>
On Mon, 3 Jul 2006, Joachim B Haga wrote:
>
> The configurability is through setting core.compression = [-1..9]
> which maps to the zlib constants; -1 is the default, 0 is no
> compression, and 1..9 are various speed/size tradeoffs, 9
> being slowest.
My only worry is that this encodes "Z_DEFAULT_COMPRESSION" as being -1,
which happens to be /true/, but I don't think that's a documented
interface (you're supposed to use the Z_DEFAULT_COMPRESSION macro, which
could have any value, and just _happens_ to be -1).
Is it likely to ever change from that -1? Probably not. So I think your
patch is technically correct, but it might just be nicer if it did
something like
..
if (!strcmp(var, "core.compression")) {
int level = git_config_int(var, value);
if (level == -1)
level = Z_DEFAULT_COMPRESSION;
else if (level < 0 || level > Z_BEST_COMPRESSION)
die("bad zlib compression level %d", level);
zlib_compression_level = level;
return 0;
}
..
which would be safer, and a smart compiler might notice that the -1 case
ends up being a no-op, and then just generate code AS IF we just had a
if (level < -1 || level > Z_BEST_COMPRESSION)
die(...
there.
Oh, and for all the same reasons, we should use
int zlib_compression_level = Z_BEST_COMPRESSION;
for the default initializer.
Hmm?
Linus
next prev parent reply other threads:[~2006-07-03 19:38 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-03 11:13 Compression speed for large files Joachim B Haga
2006-07-03 12:03 ` Alex Riesen
2006-07-03 12:42 ` Elrond
2006-07-03 13:44 ` Joachim B Haga
2006-07-03 13:32 ` Joachim Berdal Haga
[not found] ` <Pine.LN X.4.64.0607031030150.1213@localhost.localdomain>
2006-07-03 14:33 ` Nicolas Pitre
2006-07-03 14:54 ` Yakov Lerner
2006-07-03 15:17 ` Johannes Schindelin
2006-07-03 16:31 ` Linus Torvalds
2006-07-03 18:59 ` [PATCH] Make zlib compression level configurable, and change default Joachim B Haga
2006-07-03 19:33 ` Linus Torvalds [this message]
2006-07-03 19:50 ` Linus Torvalds
2006-07-03 20:11 ` Joachim B Haga
2006-07-03 19:02 ` [PATCH] Use configurable zlib compression level everywhere Joachim B Haga
2006-07-03 19:43 ` Junio C Hamano
2006-07-07 21:53 ` David Lang
2006-07-08 2:10 ` Johannes Schindelin
2006-07-03 21:45 ` Compression speed for large files Jeff King
2006-07-03 22:25 ` Joachim Berdal Haga
2006-07-03 23:02 ` Linus Torvalds
2006-07-04 5:42 ` Joachim Berdal Haga
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=Pine.LNX.4.64.0607031226370.12404@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=cjhaga@fys.uio.no \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=nico@cam.org \
--cc=raa.lkml@gmail.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;
as well as URLs for NNTP newsgroup(s).