v17-0004-Second-attempt-at-addressing-performance-regress.patch
application/octet-stream
Filename: v17-0004-Second-attempt-at-addressing-performance-regress.patch
Type: application/octet-stream
Part: 1
Message:
Re: speed up verifying UTF-8
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v17-0004
Subject: Second attempt at addressing performance regressions from chunk approach
| File | + | − |
|---|---|---|
| src/common/wchar.c | 12 | 11 |
From 29fcfe4010e58d49cad9c1c725fe2bc73942f672 Mon Sep 17 00:00:00 2001
From: John Naylor <john.naylor@2ndquadrant.com>
Date: Fri, 16 Jul 2021 17:45:31 -0400
Subject: [PATCH v17 4/4] Second attempt at addressing performance regressions
from chunk approach
---
src/common/wchar.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/common/wchar.c b/src/common/wchar.c
index 79990fe972..3365521c0a 100644
--- a/src/common/wchar.c
+++ b/src/common/wchar.c
@@ -1868,20 +1868,21 @@ pg_utf8_verifystr(const unsigned char *s, int len)
memcpy(&chunk, s, sizeof(chunk));
- /* fast path for ASCII-subset characters */
- l = check_ascii(chunk);
- if (l)
- {
- s += l;
- len -= l;
- continue;
- }
-
/* Do a quick check if the first byte is both non-zero and doesn't have the high bit set */
if ((signed char) (*s) > 0)
{
- s++;
- len--;
+ /* fast path for ASCII-subset characters */
+ l = check_ascii(chunk);
+ if (l)
+ {
+ s += l;
+ len -= l;
+ }
+ else
+ {
+ s++;
+ len--;
+ }
continue;
}
--
2.31.1