Re: [POC] verifying UTF-8 using SIMD instructions

John Naylor <john.naylor@enterprisedb.com>

From: John Naylor <john.naylor@enterprisedb.com>
To: Amit Khandekar <amitdkhan.pg@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-03-19T19:24:06Z
Lists: pgsql-hackers

Attachments

I wrote:

> Thanks for testing! Good, the speedup is about as much as I can hope for
using plain C. In the next patch I'll go ahead and squash in the ascii fast
path, using 16-byte stride, unless there are objections. I claim we can
live with the regression Heikki found on an old 32-bit Arm platform since
it doesn't seem to be true of Arm in general.

In v8, I've squashed the 16-byte stride into 0002. I also removed the sole
holdout of hard-coded intrinsics, by putting _mm_setr_epi8 inside a
variadic macro, and also did some reordering of the one-line function
definitions. (As before, 0001 is not my patch, but parts of it are a
prerequisite to my regressions tests).

Over in [1] , I tested in-situ in a COPY FROM test and found a 10% speedup
with mixed ascii and multibyte in the copy code, i.e. with buffer and
storage taken completely out of the picture.

[1]
https://www.postgresql.org/message-id/CAFBsxsEybzagsrmuoLsKYx417Sce9cgnM91nf8f9HKGLadixPg%40mail.gmail.com
--
John Naylor
EDB: http://www.enterprisedb.com

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Simplify coding style of is_valid_ascii()

  2. Apply auto-vectorization to the inner loop of numeric multiplication.