Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)

2020-04-19 Thread Ranier Vilela
Em dom., 19 de abr. de 2020 às 22:00, David Rowley escreveu: > On Mon, 20 Apr 2020 at 11:24, Ranier Vilela wrote: > > I tried: https://godbolt.org with: > > > > -O2: > > > > f1: > > int main (int argv, char **argc) > > { > > return strlen(argc[0]) == 0; > > } > > > > f1: Assembly > > main:

Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)

2020-04-19 Thread David Rowley
On Mon, 20 Apr 2020 at 11:24, Ranier Vilela wrote: > I tried: https://godbolt.org with: > > -O2: > > f1: > int main (int argv, char **argc) > { > return strlen(argc[0]) == 0; > } > > f1: Assembly > main: # @main > mov rcx, qword ptr [rsi] >

Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)

2020-04-19 Thread Ranier Vilela
Em dom., 19 de abr. de 2020 às 18:38, Tom Lane escreveu: > Tomas Vondra writes: > > On Sun, Apr 19, 2020 at 11:24:38AM -0300, Ranier Vilela wrote: > >> strlen it is one of the low fruits that can be harvested. > > > Maybe there are places where this would help, but I don't see a reason > > to ju

Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)

2020-04-19 Thread Ranier Vilela
Em dom., 19 de abr. de 2020 às 19:00, David Rowley escreveu: > On Mon, 20 Apr 2020 at 09:38, Tom Lane wrote: > > The cases where Ranier proposes to replace strlen(foo) == 0 > > with a test on foo[0] do seem like wins, though. Asking for > > the full string length to be computed is more computat

Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)

2020-04-19 Thread David Rowley
On Mon, 20 Apr 2020 at 09:38, Tom Lane wrote: > The cases where Ranier proposes to replace strlen(foo) == 0 > with a test on foo[0] do seem like wins, though. Asking for > the full string length to be computed is more computation than > necessary, and it's less clear that the compiler could be >

Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)

2020-04-19 Thread Tom Lane
Tomas Vondra writes: > On Sun, Apr 19, 2020 at 11:24:38AM -0300, Ranier Vilela wrote: >> strlen it is one of the low fruits that can be harvested. > Maybe there are places where this would help, but I don't see a reason > to just throw away all strlen calls and replace them with something > clear

Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)

2020-04-19 Thread Andreas Karlsson
On 4/19/20 10:29 PM, Ranier Vilela wrote: Em dom., 19 de abr. de 2020 às 16:33, Tomas Vondra mailto:tomas.von...@2ndquadrant.com>> escreveu: On Sun, Apr 19, 2020 at 11:24:38AM -0300, Ranier Vilela wrote: >Hi, >strlen it is one of the low fruits that can be harvested. >What i

Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)

2020-04-19 Thread Tomas Vondra
On Sun, Apr 19, 2020 at 05:29:52PM -0300, Ranier Vilela wrote: Em dom., 19 de abr. de 2020 às 16:33, Tomas Vondra < tomas.von...@2ndquadrant.com> escreveu: On Sun, Apr 19, 2020 at 11:24:38AM -0300, Ranier Vilela wrote: >Hi, >strlen it is one of the low fruits that can be harvested. >What is you

Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)

2020-04-19 Thread Ranier Vilela
Em dom., 19 de abr. de 2020 às 16:33, Tomas Vondra < tomas.von...@2ndquadrant.com> escreveu: > On Sun, Apr 19, 2020 at 11:24:38AM -0300, Ranier Vilela wrote: > >Hi, > >strlen it is one of the low fruits that can be harvested. > >What is your opinion? > > > > That assumes this actually affects/impr

Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)

2020-04-19 Thread Tomas Vondra
On Sun, Apr 19, 2020 at 11:24:38AM -0300, Ranier Vilela wrote: Hi, strlen it is one of the low fruits that can be harvested. What is your opinion? That assumes this actually affects/improves performance, without any measurements proving that. Considering large number of the places you modified

[PATCH] Small optimization across postgres (remove strlen duplicate usage)

2020-04-19 Thread Ranier Vilela
Hi, strlen it is one of the low fruits that can be harvested. What is your opinion? regards, Ranier Vilela remove_strlen.patch Description: Binary data