Re: [PATCH] Small optimization across postgres (remove strlenduplicate usage)

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: [PATCH] Small optimization across postgres (remove strlenduplicate usage)
Дата
Msg-id CAApHDvo5rrUpOzQZogwEV5ZNteE4bTZNbWN4WUFza8oinGxy0A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [PATCH] Small optimization across postgres (remove strlenduplicate usage)
Список pgsql-hackers
On Mon, 20 Apr 2020 at 09:38, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> The cases where Ranier proposes to replace strlen(foo) == 0
> with a test on foo[0] do seem like wins, though.  Asking for
> the full string length to be computed is more computation than
> necessary, and it's less clear that the compiler could be
> expected to save you from that.  Anyway there's a coding style
> proposition that we should be doing this consistently, and
> certainly lots of places do do this without using strlen().

Looking at https://godbolt.org/z/6XsjbA it seems like GCC is pretty
good at getting rid of the strlen call even at -O0. It takes -O1 for
clang to use it and -O2 for icc.

David



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)
Следующее
От: Jeff Davis
Дата:
Сообщение: v13: Performance regression related to FORTIFY_SOURCE