Re: micro-optimizing json.c
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Joe Conway <mail@joeconway.com>, Tom Lane <tgl@sss.pgh.pa.us>, Andrew Dunstan <andrew@dunslane.net>, Davin Shearer <davin@apache.org>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2023-12-08T03:32:06Z
Lists: pgsql-hackers
On Fri, Dec 08, 2023 at 04:11:52PM +1300, David Rowley wrote:
> + seplen = use_line_feeds ? sizeof(",\n ") - 1 : sizeof(",") - 1;
>
> Most modern compilers will be fine with just:
>
> seplen = strlen(sep);
>
> I had to go back to clang 3.4.1 and GCC 4.1.2 to see the strlen() call
> with that code [1].
Hm. I tried this first, but my compiler (gcc 9.4.0 on this machine) was
still doing the strlen()...
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
Commits
-
Micro-optimize datum_to_json_internal() some more.
- 0d1adae6f739 17.0 landed
-
Micro-optimize JSONTYPE_NUMERIC code path in json.c.
- dc3f9bc549d4 17.0 landed