From: | Steven Niu <niushiji(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | [PATCH] avoid double scanning in function byteain |
Date: | 2025-03-26 07:17:15 |
Message-ID: | ca315729-140b-426e-81a6-6cd5cfe7ecc5@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
The byteain function converts a string input into a bytea type.
The original implementation processes two input formats:
a hex format (starting with \x) and a traditional escaped format.
For the escaped format, the function scans the input string twice
— once to calculate the exact size of the output and allocate memory,
and again to fill the allocated memory with the parsed data.
This double scanning can be inefficient, especially for large inputs.
So I optimized the function to eliminate the need for two scans,
while preserving correctness and efficiency.
Please help review it and share your valuable comments.
Thanks,
Steven Niu
https://www.highgo.com/
Attachment | Content-Type | Size |
---|---|---|
0001-PATCH-Optimize-function-byteain-to-avoid-double-scan.patch | text/plain | 3.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2025-03-26 07:42:44 | Re: Allow default \watch interval in psql to be configured |
Previous Message | jian he | 2025-03-26 07:15:00 | support create index on virtual generated column. |