v17-0003-First-attempt-at-addressing-performance-regressi.patch

application/octet-stream

Filename: v17-0003-First-attempt-at-addressing-performance-regressi.patch
Type: application/octet-stream
Part: 3
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-0003
Subject: First attempt at addressing performance regressions from chunk approach
File+
src/common/wchar.c 8 0
From 340dbdb625425a4018e51a3bd5d91b54044be4c0 Mon Sep 17 00:00:00 2001
From: John Naylor <john.naylor@2ndquadrant.com>
Date: Fri, 16 Jul 2021 17:41:10 -0400
Subject: [PATCH v17 3/4] First attempt at addressing performance regressions
 from chunk approach

---
 src/common/wchar.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/common/wchar.c b/src/common/wchar.c
index 84cc1c6785..79990fe972 100644
--- a/src/common/wchar.c
+++ b/src/common/wchar.c
@@ -1877,6 +1877,14 @@ pg_utf8_verifystr(const unsigned char *s, int len)
 			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--;
+			continue;
+		}
+
 		/*
 		 * Found non-ASCII or zero above, so verify a single character.
 		 */
-- 
2.31.1