Re: appendBinaryStringInfo stuff

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

From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Andres Freund <andres@anarazel.de>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-12-22T07:56:11Z
Lists: pgsql-hackers
David Rowley <dgrowleyml@gmail.com> writes:
>   22.57%  postgres          [.] escape_json

Hmm ... shouldn't we do something like

-                appendStringInfoString(buf, "\\b");
+                appendStringInfoCharMacro(buf, '\\');
+                appendStringInfoCharMacro(buf, 'b');

and so on in that function?  I'm not convinced that this one
hotspot justifies inlining appendStringInfoString everywhere.

			regards, tom lane



Commits

  1. Change argument type of pq_sendbytes from char * to void *

  2. Remove useless casts to (void *) in hash_search() calls

  3. Change argument of appendBinaryStringInfo from char * to void *

  4. Use appendStringInfoString instead of appendBinaryStringInfo where possible