Re: Make MemoryContextMemAllocated() more precise
От | David Rowley |
---|---|
Тема | Re: Make MemoryContextMemAllocated() more precise |
Дата | |
Msg-id | CAApHDvqGJ6=ywHDZLaYeQMrN4W388COvEaKLQzHnY+v=YQ6Tmw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Make MemoryContextMemAllocated() more precise (Jeff Davis <pgsql@j-davis.com>) |
Список | pgsql-hackers |
On Tue, 7 Apr 2020 at 14:26, Jeff Davis <pgsql@j-davis.com> wrote: > > On Mon, 2020-04-06 at 23:39 +1200, David Rowley wrote: > > 4. Do you think it would be better to have two separate functions for > > MemoryContextCount(), a recursive version and a non-recursive > > version. > > I could, but right now the only caller passes recurse=true, so I'm not > really eliminating any code in that path by specializing the functions. > Are you thinking about performance or you just think it would be better > to have two entry points? I was thinking in terms of both performance by eliminating a branch, but mostly it was down to ease of code reading. I thought it was easier to read: MemoryContextGetCountersRecruse(&counters); then MemoryContextGetCounters(&counters, true); since I might need to go see what "true" is for. The non-recursive version, if we decide we need one, would likely just be 1 one-line body function calling the implementation's getcounter method. David
В списке pgsql-hackers по дате отправления: