Re: [PATCH v2] src/port/snprintf.c: Optimize the common base=10 case in fmtint

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Chapman Flack <chap@anastigmatix.net>, Arjan van de Ven <arjan@linux.intel.com>, Japin Li <japinli@hotmail.com>, pgsql-hackers@postgresql.org, mark.dilger@enterprisedb.com, pgsql-hackers@lists.postgresql.org
Date: 2021-10-28T20:34:06Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> Imo the code now is a bit odd, because we first switch (type) setting base,
> and then separately have branches for the different bases.

It'd be hard to merge, I think, given that the cases in the switch
don't line up one-for-one with the different bases.  You could
probably do something involving falling through between different
cases, but I think that that would be a lot harder to read;
and I'm still of the opinion that micro-optimizing this code
is probably a waste of effort for our usage.

			regards, tom lane



Commits

  1. Speed up printing of integers in snprintf.c.