Re: Duplicated assignment of slot_name in walsender.c - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Duplicated assignment of slot_name in walsender.c
Date
Msg-id 20151021213319.GG32218@awork2.anarazel.de
Whole thread Raw
In response to Re: Duplicated assignment of slot_name in walsender.c  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Duplicated assignment of slot_name in walsender.c  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Re: Duplicated assignment of slot_name in walsender.c  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On 2015-10-21 17:21:25 -0300, Alvaro Herrera wrote:
> > It seems that the 2nd assignment was an oversight. Spotted by Bernd
> > Helmle.

Yea, that's obviously redudant. Will remove.

> 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)) ...

> 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, 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

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Duplicated assignment of slot_name in walsender.c
Next
From: Andres Freund
Date:
Subject: Re: pg_recvlogical fixes