pgsql: Optimize pglz compressor for small inputs. - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Optimize pglz compressor for small inputs.
Date
Msg-id E1UtZ38-0006xD-AF@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Optimize pglz compressor for small inputs.

The pglz compressor has a significant startup cost, because it has to
initialize to zeros the history-tracking hash table. On a 64-bit system, the
hash table was 64kB in size. While clearing memory is pretty fast, for very
short inputs the relative cost of that was quite large.

This patch alleviates that in two ways. First, instead of storing pointers
in the hash table, store 16-bit indexes into the hist_entries array. That
slashes the size of the hash table to 1/2 or 1/4 of the original, depending
on the pointer width. Secondly, adjust the size of the hash table based on
input size. For very small inputs, you don't need a large hash table to
avoid collisions.

Review by Amit Kapila.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/031cc55bbea6b3a6b67c700498a78fb1d4399476

Modified Files
--------------
src/backend/utils/adt/pg_lzcompress.c |   95 +++++++++++++++++++++++----------
1 file changed, 66 insertions(+), 29 deletions(-)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: Retry short writes when flushing WAL.
Next
From: Bruce Momjian
Date:
Subject: pgsql: Remove undocumented -h (help) option