Re: Speed up JSON escape processing with SIMD plus other optimisations

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Speed up JSON escape processing with SIMD plus other optimisations
Date: 2024-06-11 12:31:23
Message-ID: 05926066-7af1-467e-80bb-470cf0f0f2fc@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2024-06-11 Tu 08:08, Melih Mutlu wrote:
> Hi David,
>
> Thanks for the patch.
>
> In 0001 patch, I see that there are some escape_json() calls with
> NUL-terminated strings and gets the length by calling strlen(), like
> below:
>
> - escape_json(&buf, "timestamp");
> + escape_json(&buf, "timestamp", strlen("timestamp"));
>
>
>  Wouldn't using escape_json_cstring() be better instead? IIUC there
> isn't much difference between escape_json() and escape_json_cstring(),
> right? We would avoid strlen() with escape_json_cstring().
>
>

or maybe use sizeof("timestamp") - 1

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2024-06-11 12:43:40 Re: Speed up JSON escape processing with SIMD plus other optimisations
Previous Message Melih Mutlu 2024-06-11 12:08:29 Re: Speed up JSON escape processing with SIMD plus other optimisations