| From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
|---|---|
| To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
| Cc: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Avoid a possible out-of-bounds access (src/backend/optimizer/util/relnode.c) |
| Date: | 2023-09-26 12:57:19 |
| Message-ID: | CAApHDvqoZ8dCSuWF60hL=EPHNr5riRvbZ6YP6wyj-fu5K0gV9Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, 27 Sept 2023 at 01:31, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> It seems to me that it adds a LEA instruction.
> https://godbolt.org/z/b4jK3PErE
There's a fairly significant difference in the optimisability of a
comparison with a compile-time constant vs a variable. For example,
would you expect the compiler to emit assembly for each side of the
boolean AND in: if (a > 12 && a > 20), or how about if (a > 12 && a >
y)? No need to answer. Just consider it.
I suggest keeping your experiments as close to the target code as
practical. You might be surprised by what the compiler can optimise.
David
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fabrízio de Royes Mello | 2023-09-26 13:00:08 | Re: Add test module for Table Access Method |
| Previous Message | Ranier Vilela | 2023-09-26 12:30:57 | Re: Avoid a possible out-of-bounds access (src/backend/optimizer/util/relnode.c) |