From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
---|---|
To: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
Cc: | dgrowleyml(at)gmail(dot)com, gurjeet(at)singh(dot)im, pgsql-hackers(at)postgresql(dot)org, michael(at)paquier(dot)xyz, andrew(at)dunslane(dot)net |
Subject: | Re: Proposal: add new API to stringinfo |
Date: | 2025-01-09 23:27:03 |
Message-ID: | Z4BbR4RGpL4O5iYj@nathan |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2025-01-09 23:59:29 | Re: Adjusting hash join memory limit to handle batch explosion |
Previous Message | Tomas Vondra | 2025-01-09 23:26:01 | Re: Adjusting hash join memory limit to handle batch explosion |