Alvaro Herrera <alvhe...@2ndquadrant.com> writes: > Andres Freund wrote: >> 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. I'm prepared to believe that *some* compilers do that, but I think it's doubtful that they all do. Even if they do, it would have to be a very tightly constrained optimization, since the compiler would have to be able to prove that there is no way for the referenced string to get changed between the two call sites. That would likely mean that some places where you think this will happen will actually end up doing the strlen() twice. I'm willing to buy the argument that performance doesn't matter in this particular context; but if we think it does, I'd rather see us explicitly save and re-use the strlen() result, so that the code behaves the same on every platform. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers