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: Japin Li <japinli@hotmail.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>, pgsql-hackers@postgresql.org, mark.dilger@enterprisedb.com, andres@anarazel.de, pgsql-hackers@lists.postgresql.org
Date: 2021-10-27T01:39:54Z
Lists: pgsql-hackers
Japin Li <japinli@hotmail.com> writes:
> Why do we need likely() for base=10, however, base=16 and base=8 don't need?

Yeah, I was a little unconvinced about that too.  I concur with writing
it as an if/else chain instead of a switch, but I'm not sure that likely()
adds anything to that.

			regards, tom lane



Commits

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