Re: micro-optimizing json.c

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Joe Conway <mail(at)joeconway(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Davin Shearer <davin(at)apache(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: micro-optimizing json.c
Date: 2023-12-08 03:32:06
Message-ID: 20231208033206.GA3479866@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-12-08 04:02:09 Re: micro-optimizing json.c
Previous Message Tom Lane 2023-12-08 03:28:50 Re: micro-optimizing json.c