Have pg_itoa, pg_ltoa and pg_lltoa return the length of the string
David Rowley <drowley@postgresql.org>
Have pg_itoa, pg_ltoa and pg_lltoa return the length of the string Core by no means makes excessive use of these functions, but quite a large number of those usages do require the caller to call strlen() on the returned string. This is quite wasteful since these functions do already have a good idea of the length of the string, so we might as well just have them return that. Reviewed-by: Andrew Gierth Discussion: https://postgr.es/m/CAApHDvrm2A5x2uHYxsqriO2cUaGcFvND%2BksC9e7Tjep0t2RK_A%40mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/common/printsimple.c | modified | +6 −4 |
| src/backend/utils/adt/int8.c | modified | +9 −2 |
| src/backend/utils/adt/int.c | modified | +1 −3 |
| src/backend/utils/adt/numutils.c | modified | +19 −13 |
| src/include/utils/builtins.h | modified | +3 −3 |
Discussion
- Speedup usages of pg_*toa() functions 19 messages · 2020-06-09 → 2020-07-02