Re: Make MemoryContextMemAllocated() more precise
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>, Tomas Vondra <tomas.vondra@postgresql.org>,
Andres Freund <andres@anarazel.de>
Date: 2020-04-07T12:14:16Z
Lists: 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
Commits
-
Create memory context for HashAgg with a reasonable maxBlockSize.
- 50a38f65177e 13.0 landed
-
Specialize MemoryContextMemAllocated().
- e00912e11a9e 13.0 landed