Re: [PATCH] Optimize json_lex_string by batching character copying

From: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Jelte Fennema <Jelte(dot)Fennema(at)microsoft(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>
Subject: Re: [PATCH] Optimize json_lex_string by batching character copying
Date: 2022-07-06 08:58:44
Message-ID: CAFBsxsE0FkMT0vZOLfJEOCM1Di81Wy_5fE9S1rn0PNHMYrmCCw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 6, 2022 at 12:18 PM Andres Freund <andres(at)anarazel(dot)de> wrote:

> I think before committing something along those lines we should make the
> relevant bits also be applicable when ->strval is NULL, as several functions
> use that (notably json_in IIRC). Afaics we'd just need to move the strval
> check to be around the appendBinaryStringInfo().

That makes sense and is easy.

> And it should simplify the
> function, because some of the relevant code is duplicated outside as well...

Not sure how far to take this, but I put the returnable paths inside
the "other" path, so only backslash will go back to the top.

Both the above changes are split into a new 0003 patch for easier
review, but in the end will likely be squashed with 0002.

--
John Naylor
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
v4-0001-Simplify-json-lexing-state.patch text/x-patch 2.7 KB
v4-0004-Use-vectorized-lookahead-in-json_lex_string-on-x8.patch text/x-patch 2.4 KB
v4-0003-Use-lookahead-path-in-json-string-lexing-for-the-.patch text/x-patch 2.6 KB
v4-0002-Build-json-strings-in-larger-chunks-during-lexing.patch text/x-patch 1.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-07-06 09:03:31 Re: [RFC] building postgres with meson -v9
Previous Message Amit Kapila 2022-07-06 08:55:39 Re: [BUG] Logical replication failure "ERROR: could not map filenode "base/13237/442428" to relation OID" with catalog modifying txns