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

From: Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, 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:08:29
Message-ID: CAGPVpCSr8TJZpsVUWciR7eVWLeEzMr1vw7gvEALUQwB4Upmhjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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().

Regards,
--
Melih Mutlu
Microsoft

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2024-06-11 12:31:23 Re: Speed up JSON escape processing with SIMD plus other optimisations
Previous Message Andrew Dunstan 2024-06-11 12:04:57 Re: RFC: adding pytest as a supported test framework