Re: [PATCH] Refactor "if(strspn(str, ...) == strlen(str)" code

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Refactor "if(strspn(str, ...) == strlen(str)" code
Дата
Msg-id 4419.1481216234@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [PATCH] Refactor "if(strspn(str, ...) == strlen(str)" code  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
Ответы Re: [PATCH] Refactor "if(strspn(str, ...) == strlen(str)" code  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
Re: [HACKERS] [PATCH] Refactor "if(strspn(str, ...) == strlen(str)"code  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
Список pgsql-hackers
Aleksander Alekseev <a.alekseev@postgrespro.ru> writes:
> How about rewriting such a code like this?
> if (pg_str_containsonly(str, " \t\n\r\f"))

Function name seems weirdly spelled.  Also, I believe that in nearly all
use-cases the number of data characters that would typically be examined
is small, so I have serious doubts that the "optimized" implementation
you propose is actually faster than a naive one; it may be slower, and
it's certainly longer and harder to understand/test.

Whether it's worth worrying about, I dunno.  This is hardly the only
C idiom you need to be familiar with to read the PG code.
        regards, tom lane



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Declarative partitioning - another take
Следующее
От: Jeff Janes
Дата:
Сообщение: postgres_fdw bug in 9.6