Re: Frontend error logging style

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Frontend error logging style
Date: 2022-04-11 15:04:30
Message-ID: c1d2b11d-d7e2-aafc-4bab-bb41b5f3b5ff@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08.04.22 22:26, Tom Lane wrote:
> I wrote:
>> One other loose end is bothering me: I stuck with logging.h's
>> original choice to put "if (likely())" or "if (unlikely())"
>> conditionals into the macros, but I rather suspect that that's
>> just a waste. I think we should put a centralized level check
>> into logging.c, and get rid of at least the "if (likely())"
>> checks, because those are going to succeed approximately 100.0%
>> of the time. Maybe there's an argument for keeping the unlikely()
>> ones.
>
> Concretely, something like the attached. As a simple check,
> I looked at the compiled size of pg_dump. It went from
>
> text data bss dec hex filename
> 380298 4008 1384 385690 5e29a /home/postgres/testversion/bin/pg_dump
>
> to
>
> text data bss dec hex filename
> 374954 4008 1384 380346 5cdba src/bin/pg_dump/pg_dump
>
> for a savings of about 5K or 1.5%. Not a huge amount, but
> not nothing either, especially considering that the existing
> coding isn't buying us anything.

Yeah, that seems ok to change. The previous coding style is more useful
if you have a lot of debug messages in a hot code path, but that usually
doesn't apply to where this is used.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-04-11 15:15:46 Re: Fixes for compression options of pg_receivewal and refactoring of backup_compression.{c,h}
Previous Message Robert Haas 2022-04-11 14:55:00 Re: [COMMITTERS] pgsql: Allow time delayed standbys and recovery