Re: [PATCH] Small optimization across postgres (remove strlenduplicate usage) - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: [PATCH] Small optimization across postgres (remove strlenduplicate usage)
Date
Msg-id 20200419193326.lf74hil2ks2vtsof@development
Whole thread Raw
In response to [PATCH] Small optimization across postgres (remove strlen duplicate usage)  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: [PATCH] Small optimization across postgres (remove strlenduplicate usage)  (Ranier Vilela <ranier.vf@gmail.com>)
Re: [PATCH] Small optimization across postgres (remove strlen duplicate usage)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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 are related to DDL (CreateComment, ChooseIndexColumnNames, ...)
or stuff that runs only once or infrequently (like the changes in
PostmasterMain or libpqrcv_get_senderinfo). Likewise, it seems entirely
pointless to worry about strlen() overhead e.g. in fsync_parent_path
which is probably dominated by I/O.

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
clearly less convenient and possibly more error-prone (I'd expect quite
a few off-by-one mistakes with this).


regards

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



pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: DETACH PARTITION and FOR EACH ROW triggers on partitioned tables
Next
From: Alexander Lakhin
Date:
Subject: Re: HEAPDEBUGALL is broken