On Thu, Jan 09, 2025 at 03:21:41PM +0900, Tatsuo Ishii wrote: > Ok, I have created v3 patch to do more inlining as you suggested. With > the patch I confirmed that there's no call to functions except palloc > in makeStringInfo, makeStringInfoExt, initStringInfo and > initStringInfoExt in the asm codes (see attached stringinfo.s).
Looks generally reasonable to me. +/* + * initStringInfoInternal + * + * Initialize a StringInfoData struct (with previously undefined contents) + * to describe an empty string. + * The initial memory allocation size is specified by 'initsize'. + * The valid range for 'initsize' is 1 to MaxAllocSize. + */ +static inline void +initStringInfoInternal(StringInfo str, int initsize) +{ + Assert(initsize > 0); + + str->data = (char *) palloc(initsize); + str->maxlen = initsize; + resetStringInfo(str); +} nitpick: Should we Assert(initsize <= MaxAllocSize) here, too? -- nathan