Hi,
On 2023-07-17 09:55:07 +0800, Zhang Mingli wrote:
> LGTM and I have a fool question:
>
> if (likely(all_visible))
> {
> if (likely(!check_serializable))
> scan->rs_ntuples = heapgetpage_collect(scan, snapshot, page, buffer,
> block, lines, 1, 0);
> else
> scan->rs_ntuples = heapgetpage_collect(scan, snapshot, page, buffer,
> block, lines, 1, 1);
> }
> else
> {
> if (likely(!check_serializable))
> scan->rs_ntuples = heapgetpage_collect(scan, snapshot, page, buffer,
> block, lines, 0, 0);
> else
> scan->rs_ntuples = heapgetpage_collect(scan, snapshot, page, buffer,
> block, lines, 0, 1);
>
>
> Does it make sense to combine if else condition and put it to the incline function’s param?
>
> Like:
> scan->rs_ntuples = heapgetpage_collect(scan, snapshot, page, buffer,
> block, lines, all_visible, check_serializable);
I think that makes it less likely that the compiler actually generates a
constant-folded version for each of the branches. Perhaps worth some
experimentation.
Greetings,
Andres Freund