Re: Add pg_strtoupper and pg_strtolower functions

Поиск
Список
Период
Сортировка
От Bharath Rupireddy
Тема Re: Add pg_strtoupper and pg_strtolower functions
Дата
Msg-id CALj2ACUdGaC_w8GBH-_B4tP=5oQd-vtmbVACbBH21O5BcrxozQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Add pg_strtoupper and pg_strtolower functions  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Список pgsql-hackers
On Mon, May 2, 2022 at 6:43 PM Ashutosh Bapat
<ashutosh.bapat.oss@gmail.com> wrote:
>
> On Mon, May 2, 2022 at 6:21 PM Bharath Rupireddy
> <bharath.rupireddyforpostgres@gmail.com> wrote:
> >
> > Hi,
> >
> > I came across pg_toupper and pg_tolower functions, converting a single
> > character, are being used in loops to convert an entire
> > null-terminated string. The cost of calling these character-based
> > conversion functions (even though small) can be avoided if we have two
> > new functions pg_strtoupper and pg_strtolower.
>
> Have we measured the saving in cost? Let's say for a million character
> long string?

I didn't spend time on figuring out the use-cases hitting all the code
areas, even if I do so, the function call cost savings might not
impress most of the time and the argument of saving function call cost
then becomes pointless.

> > Attaching a patch with these new two functions and their usage in most
> > of the possible places in the code.
>
> Converting pg_toupper and pg_tolower to "inline" might save cost
> similarly and also avoid code duplication?

I think most of the modern compilers do inline small functions. But,
inlining isn't always good as it increases the size of the code. With
the proposed helper functions, the code looks cleaner (at least IMO,
others may have different opinions though).

Regards,
Bharath Rupireddy.



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

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Add a new function and a document page to get/show all the server hooks
Следующее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Configuration Parameter/GUC value validation hook