From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Michael Banck <michael(dot)banck(at)credativ(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pg_verify_checksums and -fno-strict-aliasing |
Date: | 2018-08-31 19:55:51 |
Message-ID: | 21037.1535745351@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I wrote:
> Some of these places might be performance-critical enough that adding
> a palloc/pfree cycle would not be nice. What I was considering doing
> was inventing something like
>
> typedef union PGAlignedBuffer
> {
> char data[BLCKSZ];
> double force_align;
> } PGAlignedBuffer;
Here's a proposed patch using that approach.
Although some of the places that were using "char buf[BLCKSZ]" variables
weren't doing anything that really requires better alignment, I made
almost all of them use PGAlignedBuffer variables anyway, on the grounds
that you typically get better memcpy speed for aligned than unaligned
transfers.
I also fixed a few places that were using the palloc solution, and
one that was actually doing hand-alignment of the pointer (ugh).
I didn't try to be thorough about getting rid of such pallocs,
just fix places that seemed likely to be performance-critical.
This needs to be back-patched as relevant, of course.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
fix-under-aligned-variables-1.patch | text/x-diff | 24.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2018-08-31 20:46:52 | Re: psql \dC incorrectly shows casts "with inout" as "binary coercible" on 9.5.14 and 11beta3 |
Previous Message | Michael Paquier | 2018-08-31 18:46:47 | Re: Bug in slot.c and are replication slots ever used at Window? |