Re: Remove redundant strlen call in ReplicationSlotValidateName

Поиск
Список
Период
Сортировка
Искать
От
Japin Li
Тема
Re: Remove redundant strlen call in ReplicationSlotValidateName
Дата
Msg-id
MEYP282MB1669AC6E54DF99948185A54EB6119@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Ответ на
Список
Дерево обсуждения
Re: Remove redundant strlen call in ReplicationSlotValidateName Alvaro Herrera <alvherre@alvh.no-ip.org>
Re: Remove redundant strlen call in ReplicationSlotValidateName Ranier Vilela <ranier.vf@gmail.com>
Re: Remove redundant strlen call in ReplicationSlotValidateName Ranier Vilela <ranier.vf@gmail.com>
Re: Remove redundant strlen call in ReplicationSlotValidateName Peter Smith <smithpb2250@gmail.com>
Re: Remove redundant strlen call in ReplicationSlotValidateName Ranier Vilela <ranier.vf@gmail.com>

On Fri, 16 Jul 2021 at 18:05, David Rowley  wrote:
> On Fri, 16 Jul 2021 at 20:35, Japin Li  wrote:
>> > When I fix a bug about ALTER SUBSCRIPTION ... SET (slot_name) [1], Ranier Vilela
>> > finds that ReplicationSlotValidateName() has redundant strlen() call, Since it's
>> > not related to that problem, so I start a new thread to discuss it.
>
> I think this is a waste of time.  The first strlen() call is just
> checking for an empty string. I imagine all compilers would just
> optimise that to checking if the first char is '\0';
>
> https://godbolt.org/z/q58EGYMfM
>

Thanks for your review, this tool is amazing.  The two writes on some compiler
might be difference.  As Amit Kapila said, it might be helpless for reducing
overhead.

https://godbolt.org/z/j5on6Khxb


-- 
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.


В списке pgsql-hackers по дате отправления
От: Ranier Vilela
Дата:
От: Ranier Vilela
Дата:
FAQ