Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c)
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Ranier Vilela <ranier.vf@gmail.com>,
Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
Justin Pryzby <pryzby@telsasoft.com>,
Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2022-05-18T23:20:13Z
Lists: pgsql-hackers
David Rowley <dgrowleyml@gmail.com> writes: > I've been wondering for a while if we really need to have the MemSet() > macro. I see it was added in 8cb415449 (1997). I think compilers have > evolved quite a bit in the past 25 years, so it could be time to > revisit that. Yeah, I've thought for awhile that technology has moved on from that. Nobody's really taken the trouble to measure it though. (And no, results from one compiler on one machine are not terribly convincing.) The thing that makes this a bit more difficult than it might be is the special cases we have for known-aligned and so on targets, which are particularly critical for palloc0 and makeNode etc. So there's more than one case to look into. But I'd argue that those special cases are actually what we want to worry about the most: zeroing relatively small, known-aligned node structs is THE use case. regards, tom lane
Commits
-
Replace many MemSet calls with struct initialization
- 9fd45870c143 16.0 landed
-
Change some unnecessary MemSet calls
- 258f48f858b0 16.0 landed
-
Avoid unnecessary MemSet call
- 8cd61d288adf 16.0 landed