pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Nathan Bossart <nathandbossart@gmail.com>
To: John Naylor <john.naylor@enterprisedb.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jelte Fennema <Jelte.Fennema@microsoft.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: Merlin Moncure <mmoncure@gmail.com>
Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: Stephen Frost <sfrost@snowman.net>
Subject: Re: [PATCH] Optimize json_lex_string by batching character copying
Date: Mon, 15 Aug 2022 14:23:04 -0700
Message-ID: <20220815212304.GA251709@nathanxps13> (raw )
In-Reply-To: <CAFBsxsESLUyJ5spfOSyPrOvKUEYYNqsBosue9SV1j8ecgNXSKA@mail.gmail.com >
References: <20220625001810.q4giojmraweoyl5e@alap3.anarazel.de >
<20220625010551.r5qrk5n2euuwqos3@alap3.anarazel.de >
<CAFBsxsGhaR2KQ5eisaK=6Vm60t=axhD8Ckj1qFoCH1pktZi+2w@mail.gmail.com >
<20220706051801.gfbzjxgflbsglyt6@awork3.anarazel.de >
<CAFBsxsE0FkMT0vZOLfJEOCM1Di81Wy_5fE9S1rn0PNHMYrmCCw@mail.gmail.com >
<20220711154150.hwzw7qw2k6iahofy@awork3.anarazel.de >
<1119852.1657554806@sss.pgh.pa.us >
<20220711160728.tljbnowfgxefdbli@awork3.anarazel.de >
<CAFBsxsGzaaGLF=Nuq61iRXTyspbO9rOjhSqFN=V6ozzmta5mXg@mail.gmail.com >
<CAFBsxsESLUyJ5spfOSyPrOvKUEYYNqsBosue9SV1j8ecgNXSKA@mail.gmail.com >
On Mon, Aug 15, 2022 at 08:33:21PM +0700, John Naylor wrote:
> The attached implements the above, more or less, using new pg_lfind8()
> and pg_lfind8_le(), which in turn are based on helper functions that
> act on a single vector. The pg_lfind* functions have regression tests,
> but I haven't done the same for json yet. I went the extra step to use
> bit-twiddling for non-SSE builds using uint64 as a "vector", which
> still gives a pretty good boost (test below, min of 3):
Looks pretty reasonable to me.
> +#ifdef USE_SSE2
> + chunk = _mm_loadu_si128((const __m128i *) &base[i]);
> +#else
> + memcpy(&chunk, &base[i], sizeof(chunk));
> +#endif /* USE_SSE2 */
> +#ifdef USE_SSE2
> + chunk = _mm_loadu_si128((const __m128i *) &base[i]);
> +#else
> + memcpy(&chunk, &base[i], sizeof(chunk));
> +#endif /* USE_SSE2 */
Perhaps there should be a macro or inline function for loading a vector so
that these USE_SSE2 checks can be abstracted away, too.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
view thread (37+ messages) latest in thread
Message-ID: <20220815212304.GA251709@nathanxps13>
Permalink: ../20220815212304.GA251709@nathanxps13/
Also on: postgresql.org/message-id/20220815212304.GA251709@nathanxps13
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, john.naylor@enterprisedb.com, andres@anarazel.de, tgl@sss.pgh.pa.us, Jelte.Fennema@microsoft.com, mmoncure@gmail.com, andrew.dunstan@2ndquadrant.com, sfrost@snowman.net
Subject: Re: [PATCH] Optimize json_lex_string by batching character copying
In-Reply-To: <20220815212304.GA251709@nathanxps13>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox