*
* Copyright (c) 1999-2007, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.26 2007/04/06 04:21:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.27 2007/08/04 21:53:00 tgl Exp $
* ----------
*/
#include "postgres.h"
* ----------
*/
static const PGLZ_Strategy strategy_default_data = {
- 256, /* Data chunks smaller 256 bytes are not
- * compressed */
- 6144, /* Data chunks greater equal 6K force
- * compression */
- /* except compressed result is greater uncompressed data */
- 20, /* Compression rates below 20% mean fallback
- * to uncompressed */
- /* storage except compression is forced by previous parameter */
+ 256, /* Data chunks less than 256 bytes are not
+ * compressed */
+ 6144, /* Data chunks >= 6K force compression, unless
+ * compressed output is larger than input */
+ 20, /* Below 6K, compression rates below 20% mean
+ * fallback to uncompressed */
128, /* Stop history lookup if a match of 128 bytes
- * is found */
+ * is found */
10 /* Lower good match size by 10% at every
- * lookup loop iteration. */
+ * lookup loop iteration */
};
const PGLZ_Strategy * const PGLZ_strategy_default = &strategy_default_data;
static const PGLZ_Strategy strategy_always_data = {
- 0, /* Chunks of any size are compressed */
- 0, /* */
- 0, /* We want to save at least one single byte */
+ 0, /* Chunks of any size are compressed */
+ 0,
+ 0, /* It's enough to save one single byte */
128, /* Stop history lookup if a match of 128 bytes
- * is found */
- 6 /* Look harder for a good match. */
+ * is found */
+ 6 /* Look harder for a good match */
};
const PGLZ_Strategy * const PGLZ_strategy_always = &strategy_always_data;
* If the strategy forbids compression (at all or if source chunk too
* small), fail.
*/
- if (strategy->match_size_good == 0 ||
+ if (strategy->match_size_good <= 0 ||
slen < strategy->min_input_size)
return false;
*
* Definitions for the builtin LZ compressor
*
- * $PostgreSQL: pgsql/src/include/utils/pg_lzcompress.h,v 1.14 2007/02/27 23:48:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/pg_lzcompress.h,v 1.15 2007/08/04 21:53:00 tgl Exp $
* ----------
*/
*
* min_input_size Minimum input data size to start compression.
*
- * force_input_size Input data size at which compressed storage is
- * forced even if the compression rate drops below
- * min_comp_rate (but not below 0).
- *
- * min_comp_rate Minimum compression rate (0-99%), the output
- * must be smaller than the input. If that isn't
+ * force_input_size Minimum input data size to force compression
+ * even if the compression rate drops below
+ * min_comp_rate. But in any case the output
+ * must be smaller than the input. If that isn't
* the case, the compressor will throw away its
* output and copy the original, uncompressed data
* to the output buffer.
*
+ * min_comp_rate Minimum compression rate (0-99%) to require for
+ * inputs smaller than force_input_size. If not
+ * achieved, the output will be uncompressed.
+ *
* match_size_good The initial GOOD match size when starting history
* lookup. When looking up the history to find a
* match that could be expressed as a tag, the
* longer the lookup takes, the smaller matches
* are considered good.
*
- * match_size_drop The percentage, match_size_good is lowered
- * at each history check. Allowed values are
+ * match_size_drop The percentage by which match_size_good is lowered
+ * after each history check. Allowed values are
* 0 (no change until end) to 100 (only check
* latest history entry at all).
* ----------