On Thu, Dec 22, 2022 at 4:19 PM David Rowley <
dgrowleyml@gmail.com> wrote:
>
> Test 1 (from earlier)
>
> master + escape_json using appendStringInfoCharMacro
> $ pgbench -n -T 60 -f bench.sql -M prepared postgres | grep latency
> latency average = 1.807 ms
> latency average = 1.800 ms
> latency average = 1.812 ms (~4.8% faster than master)
>
23.05% postgres [.] pg_utf_mblenI get about 20% improvement by adding an ascii fast path in pg_mbstrlen_with_len, which I think would work with all encodings we support:
@@ -1064,7 +1064,12 @@ pg_mbstrlen_with_len(const char *mbstr, int limit)
while (limit > 0 && *mbstr)
{
- int l = pg_mblen(mbstr);
+ int l;
+
+ if (!IS_HIGHBIT_SET(*mbstr))
+ l = 1;
+ else
+ l = pg_mblen(mbstr);
--
John Naylor
EDB:
http://www.enterprisedb.com