Re: micro-optimizing json.c

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: micro-optimizing json.c
Дата
Msg-id 1359565.1702006130@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: micro-optimizing json.c  (Nathan Bossart <nathandbossart@gmail.com>)
Ответы Re: micro-optimizing json.c  (Nathan Bossart <nathandbossart@gmail.com>)
Список pgsql-hackers
Nathan Bossart <nathandbossart@gmail.com> writes:
> I did both of these in v2, although I opted to test that the first
> character after the optional '-' was a digit instead of testing that it was
> _not_ an 'I' or 'N'.

Yeah, I thought about that too after sending my message.  This version
LGTM, although maybe the comment could be slightly more verbose with
explicit reference to Inf/NaN as being the cases we need to quote.

> I think there are some similar improvements that we can make for
> JSONTYPE_BOOL and JSONTYPE_CAST, but I haven't tested them yet.

I am suspicious of using

    appendStringInfo(result, "\"%s\"", ...);

in each of these paths; snprintf is not a terribly cheap thing.
It might be worth expanding that to appendStringInfoChar/
appendStringInfoString/appendStringInfoChar.

            regards, tom lane



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

Предыдущее
От: Nathan Bossart
Дата:
Сообщение: Re: micro-optimizing json.c
Следующее
От: Nathan Bossart
Дата:
Сообщение: Re: micro-optimizing json.c