Teach convert() and friends to avoid copying when possible.
Nathan Bossart <nathan@postgresql.org>
Teach convert() and friends to avoid copying when possible. Presently, pg_convert() allocates a new bytea and copies the result regardless of whether any conversion actually happened. This commit adjusts this function to return the source pointer as-is if no conversion occurred. This optimization isn't expected to make a tremendous difference, but it still seems worthwhile to avoid unnecessary memory allocations. Author: Yurii Rashkovskii Reviewed-by: Bertrand Drouvot Discussion: https://postgr.es/m/CA%2BRLCQyknBPSWXRBQGOi6aYEcdQ9RpH9Kch4GjoeY8dQ3D%2Bvhw%40mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/mb/mbutils.c | modified | +6 −6 |
Discussion
- [PATCH] pg_convert improvement 8 messages · 2023-11-24 → 2023-12-04