From: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
---|---|
To: | Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> |
Cc: | Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: pglz compression performance, take two |
Date: | 2021-06-27 10:41:35 |
Message-ID: | 88C049C6-1B86-4EF7-940D-585B07FEB81B@yandex-team.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> 20 марта 2021 г., в 00:35, Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> написал(а):
>
>
>
>> On Jan 21, 2021, at 6:48 PM, Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:
>>
>> @cfbot: rebased
>> <0001-Reorganize-pglz-compression-code.patch>
>
> Review comments.
Thanks for the review, Mark!
And sorry for such a long delay, I've been trying to figure out a way to do things less-platform dependent.
And here's what I've come up with.
We use pglz_read32() not the way xxhash and lz4 does - we really do not need to get 4-byte value, we only need to compare 4 bytes at once.
So, essentially, we need to compare two implementation of 4-byte comparison
bool
cpm_a(const void *ptr1, const void *ptr2)
{
return *(const uint32_t *) ptr1 == *(const uint32_t *) ptr2;
}
bool
cmp_b(const void *ptr1, const void *ptr2)
{
return memcmp(ptr1, ptr2, 4) == 0;
}
Variant B is more portable. Inspecting it Godblot's compiler explorer I've found out that for GCC 7.1+ it generates assembly without memcmp() call. For x86-64 and ARM64 assembly of cmp_b is identical to cmp_a.
So I think maybe we could just stick with version cmp_b instead of optimising for ARM6 and similar architectures like Arduino.
I've benchmarked the patch with "REINDEX table pgbench_accounts" on pgbench -i of scale 100. wal_compression was on, other settings were default.
Without patch it takes ~11055.077 ms on my machine, with patch it takes ~9512.411 ms, 14% speedup overall.
PFA v5.
Thanks!
Best regards, Andrey Borodin.
Attachment | Content-Type | Size |
---|---|---|
v5-0001-Reorganize-pglz-compression-code.patch | application/octet-stream | 20.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Ranier Vilela | 2021-06-27 13:06:00 | Re: Deparsing rewritten query |
Previous Message | Julien Rouhaud | 2021-06-27 08:40:25 | Re: Farewell greeting |