Re: define pg_structiszero(addr, s, r)

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: define pg_structiszero(addr, s, r)
Date: 2024-11-08 05:34:34
Message-ID: Zy2i6qf0AdJ_4Tq8@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 07, 2024 at 08:41:34AM +0000, Bertrand Drouvot wrote:
> Yeah, fully agree. My initial testing was not "good" enough and so was not showing
> as much improvement as your's and David's ones.
>
> Please find v8 attached.

I've tested that with a couple of structures in an independent module
and that seems to do the job. The patch should be split into two
parts for clarity: one to switch pg_memory_is_all_zeros to use the
optimized version and a second to change PageIsVerifiedExtended().
Not a big deal as the code paths are entirely independent, that's just
my view of the matter.

I've done a round of comment and term cleanup for the whole patch,
while on it.

Btw, gcc seems a bit smarter than clang when it comes to optimizing
the code depending on the size of the structures. gcc gives up on
SIMD if it's sure that the structure on which we are going to use the
allzero check won't need it at all, and clang keeps it even if it does
not need it. That was interesting to see, while going through the
review..
--
Michael

Attachment Content-Type Size
v9-0001-Optimize-pg_memory_is_all_zeros.patch text/x-diff 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2024-11-08 06:02:34 Re: New "single" COPY format
Previous Message Michael Paquier 2024-11-08 04:33:45 Re: [PATCH] Refactor bytea_sortsupport()