Re: Fix incorrect comments in tuplesort.c

2025-12-09 Thread David Rowley
On Mon, 8 Dec 2025 at 15:08, cca5507 wrote: > > Using "However" here indicates some exception to what's just been > > said, but there is no longer an exception. To write about what the > > 1024 is for, we might need to reverse engineer what that's for. I > > assume it's something like "Clamp at 10

Re: Fix incorrect comments in tuplesort.c

2025-12-07 Thread cca5507
Hi, > Using "However" here indicates some exception to what's just been > said, but there is no longer an exception. To write about what the > 1024 is for, we might need to reverse engineer what that's for. I > assume it's something like "Clamp at 1024 elements to avoid excessive > reallocs of the

Re: Fix incorrect comments in tuplesort.c

2025-12-07 Thread Chao Li
> On Dec 8, 2025, at 08:28, David Rowley wrote: > > + * in grow_memtuples(). However, we don't consider array sizes > + * less than 1024. > > Using "However" here indicates some exception to what's just been > said, but there is no longer an exception. To write about what the > 1024 is for,

Re: Fix incorrect comments in tuplesort.c

2025-12-07 Thread David Rowley
On Mon, 8 Dec 2025 at 12:10, David G. Johnston wrote: > > On Sun, Dec 7, 2025 at 3:09 PM David Rowley wrote: >> >> The comment is effectively >> explaining that we don't want to make the array big enough so that a >> malloc will always be required. > > > Doesn't what you are saying contradict bot

Re: Fix incorrect comments in tuplesort.c

2025-12-07 Thread David G. Johnston
On Sun, Dec 7, 2025 at 3:09 PM David Rowley wrote: > The comment is effectively > explaining that we don't want to make the array big enough so that a > malloc will always be required. Doesn't what you are saying contradict both the formula (the +1 post-division) and the comments: /* * Initial

Re: Fix incorrect comments in tuplesort.c

2025-12-07 Thread David Rowley
On Sun, 7 Dec 2025 at 21:34, cca5507 wrote: > I find that the initial size of memtuples array must be more than > ALLOCSET_SEPARATE_THRESHOLD > is not for lower overhead of allocation, but for a bug fixed in > 8ea3e7a75c0d22c41c57f59c8b367059b97d0b66. > > Attach a new patch. I find the current

Re: Fix incorrect comments in tuplesort.c

2025-12-07 Thread cca5507
Hi, I find that the initial size of memtuples array must be more than ALLOCSET_SEPARATE_THRESHOLD is not for lower overhead of allocation, but for a bug fixed in 8ea3e7a75c0d22c41c57f59c8b367059b97d0b66. Attach a new patch. -- Regards, ChangAo Chen v2-0001-Fix-incorrect-comments-in-tuplesort

Re: Fix incorrect comments in tuplesort.c

2025-12-06 Thread David G. Johnston
On Saturday, December 6, 2025, cca5507 wrote: > Hi Chao, > > Thank you for your reply. > > I feed the comment to Github Copilot and he says it's incorrect. The > "slightly" is just what he suggests. > > Your suggestion also LGTM. > I don’t think just adding the word “slightly” is a good fix here

Re: Fix incorrect comments in tuplesort.c

2025-12-06 Thread cca5507
Hi Chao, Thank you for your reply. I feed the comment to Github Copilot and he says it's incorrect. The "slightly" is just what he suggests. Your suggestion also LGTM. -- Regards, ChangAo Chen

Re: Fix incorrect comments in tuplesort.c

2025-12-06 Thread Chao Li
> On Dec 6, 2025, at 22:56, cca5507 wrote: > > Hi, > > The incorrect comment: > > ``` > /* > * Initial size of memtuples array. We're trying to select this size so that > * array doesn't exceed ALLOCSET_SEPARATE_THRESHOLD and so that the overhead of > * allocation might possibly be lowered.

Fix incorrect comments in tuplesort.c

2025-12-06 Thread cca5507
Hi, The incorrect comment: ``` /* * Initial size of memtuples array. We're trying to select this size so that * array doesn't exceed ALLOCSET_SEPARATE_THRESHOLD and so that the overhead of * allocation might possibly be lowered. However, we don't consider array sizes * less than 1024. * *