diff options
author | Bruce Momjian <bruce@momjian.us> | 2002-11-11 03:02:20 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2002-11-11 03:02:20 +0000 |
commit | 75fee4535d1a9741474b53bd46a3585ad3c66eb5 (patch) | |
tree | de4500a8b76fdb882f055ad7bd8889be9d51c790 /src/backend/utils/cache | |
parent | 5d283d89cb6142d721c095c28be19056ad620616 (diff) | |
download | postgresql-75fee4535d1a9741474b53bd46a3585ad3c66eb5.tar.gz postgresql-75fee4535d1a9741474b53bd46a3585ad3c66eb5.zip |
Back out use of palloc0 in place if palloc/MemSet. Seems constant len
to MemSet is a performance boost.
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r-- | src/backend/utils/cache/catcache.c | 5 | ||||
-rw-r--r-- | src/backend/utils/cache/relcache.c | 17 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c index 1d10a103bdc..ffae38015b6 100644 --- a/src/backend/utils/cache/catcache.c +++ b/src/backend/utils/cache/catcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.100 2002/11/10 07:25:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.101 2002/11/11 03:02:19 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -808,7 +808,8 @@ InitCatCache(int id, * * Note: we assume zeroing initializes the Dllist headers correctly */ - cp = (CatCache *) palloc0(sizeof(CatCache) + NCCBUCKETS * sizeof(Dllist)); + cp = (CatCache *) palloc(sizeof(CatCache) + NCCBUCKETS * sizeof(Dllist)); + MemSet((char *) cp, 0, sizeof(CatCache) + NCCBUCKETS * sizeof(Dllist)); /* * initialize the cache's relation information for the relation diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 28431b5c5cc..11bb211c808 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.178 2002/11/10 07:25:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.179 2002/11/11 03:02:19 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1348,9 +1348,13 @@ formrdesc(const char *relationName, /* * allocate new relation desc + */ + relation = (Relation) palloc(sizeof(RelationData)); + + /* * clear all fields of reldesc */ - relation = (Relation) palloc0(sizeof(RelationData)); + MemSet((char *) relation, 0, sizeof(RelationData)); relation->rd_targblock = InvalidBlockNumber; /* make sure relation is marked as having no open file yet */ @@ -1376,7 +1380,8 @@ formrdesc(const char *relationName, * get us launched. RelationCacheInitializePhase2() will read the * real data from pg_class and replace what we've done here. */ - relation->rd_rel = (Form_pg_class) palloc0(CLASS_TUPLE_SIZE); + relation->rd_rel = (Form_pg_class) palloc(CLASS_TUPLE_SIZE); + MemSet(relation->rd_rel, 0, CLASS_TUPLE_SIZE); namestrcpy(&relation->rd_rel->relname, relationName); relation->rd_rel->relnamespace = PG_CATALOG_NAMESPACE; @@ -2049,7 +2054,8 @@ RelationBuildLocalRelation(const char *relname, /* * allocate a new relation descriptor and fill in basic state fields. */ - rel = (Relation) palloc0(sizeof(RelationData)); + rel = (Relation) palloc(sizeof(RelationData)); + MemSet((char *) rel, 0, sizeof(RelationData)); rel->rd_targblock = InvalidBlockNumber; @@ -2087,7 +2093,8 @@ RelationBuildLocalRelation(const char *relname, /* * initialize relation tuple form (caller may add/override data later) */ - rel->rd_rel = (Form_pg_class) palloc0(CLASS_TUPLE_SIZE); + rel->rd_rel = (Form_pg_class) palloc(CLASS_TUPLE_SIZE); + MemSet((char *) rel->rd_rel, 0, CLASS_TUPLE_SIZE); namestrcpy(&rel->rd_rel->relname, relname); rel->rd_rel->relnamespace = relnamespace; |