Re: Use appendStringInfoSpaces more

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Use appendStringInfoSpaces more
Дата
Msg-id CAApHDvon2EoCh-Os98dvcMfGzyeo53ru7YGdXmmbPjm3Bmmstg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Use appendStringInfoSpaces more  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Fri, 20 Jan 2023 at 10:25, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Peter Smith <smithpb2250@gmail.com> writes:
> > Should the add_indent function also have a check to avoid making
> > unnecessary calls to appendStringInfoSpaces when the level is 0?
>
> Seems like unnecessary extra notation, seeing that appendStringInfoSpaces
> will fall out quickly for a zero argument.

Yeah agreed. As far as I see it, the level will only be 0 before the
first WJB_BEGIN_OBJECT and those appear to be the first thing in the
document, so we'll only indent level 0 once and everything else will
be > 0. So, it also seems to me that the additional check is more
likely to cost more than it would save.

David



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Decoupling antiwraparound autovacuum from special rules around auto cancellation
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Fix GetWALAvailability function code comments for WALAVAIL_REMOVED return value