Re: Use appendStringInfoSpaces more
От | Peter Smith |
---|---|
Тема | Re: Use appendStringInfoSpaces more |
Дата | |
Msg-id | CAHut+Pspx8K8GSVLH4UbvQffSJABbXwsYOH+0xB5jC61k-oUqw@mail.gmail.com обсуждение исходный текст |
Ответ на | Use appendStringInfoSpaces more (David Rowley <dgrowleyml@gmail.com>) |
Ответы |
Re: Use appendStringInfoSpaces more
Re: Use appendStringInfoSpaces more |
Список | pgsql-hackers |
On Thu, Jan 19, 2023 at 8:45 PM David Rowley <dgrowleyml@gmail.com> wrote: > > In [1] I noticed a bit of a poor usage of appendStringInfoString which > just appends 4 spaces in a loop, one for each indent level of the > jsonb. It should be better just to use appendStringInfoSpaces and > just append all the spaces in one go rather than appending 4 spaces in > a loop. That'll save having to check enlargeStringInfo() once for each > loop. > Should the add_indent function also have a check to avoid making unnecessary calls to appendStringInfoSpaces when the level is 0? e.g. if (indent) { appendStringInfoCharMacro(out, '\n'); if (level > 0) appendStringInfoSpaces(out, level * 4); } V. if (indent) { appendStringInfoCharMacro(out, '\n'); appendStringInfoSpaces(out, level * 4); } ------ Kind Regards, Peter Smith. Fujitsu Australia
В списке pgsql-hackers по дате отправления: