| From: | Li Japin <japinli(at)hotmail(dot)com> |
|---|---|
| To: | Julien Rouhaud <rjuju123(at)gmail(dot)com> |
| Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Optimize memory allocation code |
| Date: | 2020-09-26 00:32:28 |
| Message-ID: | 52DAC3C2-F31A-4C73-B23C-D5C1F99BF38A@hotmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Sep 26, 2020, at 8:09 AM, Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote:
>
> Hi,
>
> On Sat, Sep 26, 2020 at 12:14 AM Li Japin <japinli(at)hotmail(dot)com> wrote:
>>
>> Hi, hackers!
>>
>> I find the palloc0() is similar to the palloc(), we can use palloc() inside palloc0()
>> to allocate space, thereby I think we can reduce duplication of code.
>
> The code is duplicated on purpose. There's a comment at the beginning
> that mentions it:
>
> /* duplicates MemoryContextAllocZero to avoid increased overhead */
>
> Same for MemoryContextAllocZero() itself.
Thanks! How big is this overhead? Is there any way I can test it?
Best regards!
--
Japin Li
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Merlin Moncure | 2020-09-26 00:37:07 | Re: Optimize memory allocation code |
| Previous Message | Andy Fan | 2020-09-26 00:16:52 | Re: Dynamic gathering the values for seq_page_cost/xxx_cost |