From: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
---|---|
To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Cc: | David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de> |
Subject: | Re: Speedup usages of pg_*toa() functions |
Date: | 2020-06-09 18:52:59 |
Message-ID: | 874krk6ppv.fsf@news-spur.riddles.org.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>>>>> "Ranier" == Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> writes:
Ranier> Where " ends up with two copies of pg_ultoa_n inlined into it",
Ranier> in this simplified example?
The two references to sprintf are both inlined copies of your pg_utoa.
Ranier> (b) I call this tail cut, I believe it saves time, for sure.
You seem to have missed the point that the pg_ultoa_n / pg_ulltoa_n
functions DO NOT ADD A TRAILING NUL. Which means that pg_ltoa / pg_lltoa
can't just tail call them, since they must add the NUL after.
Ranier> Regarding bugs:
Ranier> (c) your version don't check size of a var, when pg_ulltoa_n
Ranier> warning about "least MAXINT8LEN bytes."
Ranier> So in theory, I could blow it up, by calling pg_lltoa.
No. Callers of pg_lltoa are required to provide a buffer of at least
MAXINT8LEN+1 bytes.
--
Andrew.
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2020-06-09 19:20:08 | Re: elog(DEBUG2 in SpinLocked section. |
Previous Message | Ranier Vilela | 2020-06-09 18:37:57 | Re: Speedup usages of pg_*toa() functions |