Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc? - Mailing list pgsql-hackers

From John Naylor
Subject Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Date
Msg-id CANWCAZaAqg=vz3gkMndbn+MKA863Oy-Y-VJSSGP7gJ+vgTV1ew@mail.gmail.com
Whole thread
In response to Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?  (Lukas Fittl <lukas@fittl.com>)
Responses Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
List pgsql-hackers
On Tue, Mar 24, 2026 at 2:16 PM Lukas Fittl <lukas@fittl.com> wrote:
>
> Hi John,
>
> On Mon, Mar 23, 2026 at 12:01 AM John Naylor <johncnaylorls@gmail.com> wrote:
> > It's not that bad that the hard-coded indexes are in two places, but
> > it's also not necessary. I think "#define EAX 0 ...etc" is a fine,
> > straightforward increase in readability compared to what we have now,
> > and I don't see any downside. I suppose one argument in favor of the
> > struct is that it avoids declaring variables of type
> > array-of-4-unsigned in multiple places, but I think the array is fine,
> > and adding a new typedef is additional cognitive friction.
>
> Sounds good, lets do it that way - adjusted to use macros instead of a struct.

Looks good. The only thing that I would change is the single-letter
parameter/variable name "r". We could call it "reg" and it'd still be
pretty short. If you agree or have another suggestion, I can change
locally before pushing 0001 -- no need for a new patch set yet.

> > Speaking of signedness, why is the array of ints sometimes signed and
> > sometimes unsigned?
>
> The signedness is a MSVC-ism - I think its reasonable for us to work
> with unsigned integers in our code, and pass them by casting to
> __cpuid/__cpuidex (the MSVC variants).

CI works with this, so fine by me.

--
John Naylor
Amazon Web Services



pgsql-hackers by date:

Previous
From: Yugo Nagata
Date:
Subject: Re: Allow to collect statistics on virtual generated columns
Next
From: Ashutosh Bapat
Date:
Subject: Re: SQL Property Graph Queries (SQL/PGQ)