| From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Cc: | David Rowley <dgrowleyml(at)gmail(dot)com> |
| Subject: | Use stack allocated StringInfoDatas, where possible (round 2) |
| Date: | 2026-04-12 10:49:38 |
| Message-ID: | adt4wpj4FZwR+S7I@ip-10-97-1-34.eu-west-3.compute.internal |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi hackers,
Commit 6d0eba66275 already did most of the changes but missed the opportunities
to $SUBJECT in sequencesync.c.
Indeed, 5509055d6956 added a few cases that are using StringInfo but don't need
that StringInfo to exist beyond the scope of the function were using makeStringInfo(),
which allocates both a StringInfoData and the buffer it uses as two separate
allocations. It's more efficient for these cases to use a StringInfoData on the
stack and initialize it with initStringInfo(), which only allocates the string
buffer.
The reason 6d0eba66275 missed those is that 5509055d6956 has been committed
between the patch proposal for 6d0eba66275 and 6d0eba66275.
I used Mats's coccinelle script (mentioned in [1]) to find those and they are the
only remaining ones.
[1]: https://postgr.es/m/4379aac8-26f1-42f2-a356-ff0e886228d3%40gmail.com
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Use-stack-allocated-StringInfoDatas-where-possibl.patch | text/x-diff | 5.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thomas Munro | 2026-04-12 11:37:19 | ISBN range table |
| Previous Message | SATYANARAYANA NARLAPURAM | 2026-04-12 09:33:19 | Re: var_is_nonnullable() fails to handle invalid NOT NULL constraints |