Re: Duplicated assignment of slot_name in walsender.c

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Duplicated assignment of slot_name in walsender.c
Дата
Msg-id 20151021215323.GE3391@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: Duplicated assignment of slot_name in walsender.c  (Andres Freund <andres@anarazel.de>)
Ответы Re: Duplicated assignment of slot_name in walsender.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Andres Freund wrote:
> On 2015-10-21 17:21:25 -0300, Alvaro Herrera wrote:

> > I think the first assignment is also pointless -- I mean can't we just
> > use MyReplicationSlot->data.name in both places where slot_name is used?
> 
> Makes the lines a bit long. strlen(NameStr(MyReplicationSlot->data.name)) ...

Meh.  Assign the strlen somewhere?

> > In the same routine, it seems wasteful to be doing strlen() twice for
> > every string sent over the wire.
> 
> That seems fairly insignificant. For one this is a rather infrequent and
> expensive operation,

OK, I can buy that.

> for another every decent compiler can optimize those away. Note that
> those duplicate strlen() calls are there in a lot of places in
> walsender.c

It can?  Tom has repeatedly argue the opposite, in the past.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: pg_recvlogical fixes
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Duplicated assignment of slot_name in walsender.c