From 408a86b0dc6f1fdd582b64857c2568150afbe4d5 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 12 Aug 2007 20:18:06 +0000 Subject: [PATCH] Increase the initial size of StringInfo buffers to 1024 bytes (from 256); likewise increase the initial size of the scanner's literal buffer to 1024 (from 128). Instrumentation of the regression tests suggests that this saves a useful amount of repalloc() traffic --- the number of calls occurring during one set of tests drops from about 6900 to about 3900. The old sizes were chosen in the late 90's with an eye to machines much smaller than are common today. --- src/backend/lib/stringinfo.c | 2 +- src/backend/parser/scan.l | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/lib/stringinfo.c b/src/backend/lib/stringinfo.c index 716c6a8b3f..cf8d19977e 100644 --- a/src/backend/lib/stringinfo.c +++ b/src/backend/lib/stringinfo.c @@ -45,7 +45,7 @@ makeStringInfo(void) void initStringInfo(StringInfo str) { - int size = 256; /* initial default buffer size */ + int size = 1024; /* initial default buffer size */ str->data = (char *) palloc(size); str->maxlen = size; diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l index ae775ebab9..2e16215856 100644 --- a/src/backend/parser/scan.l +++ b/src/backend/parser/scan.l @@ -820,7 +820,7 @@ scanner_init(const char *str) scanbufhandle = yy_scan_buffer(scanbuf, slen + 2); /* initialize literal buffer to a reasonable but expansible size */ - literalalloc = 128; + literalalloc = 1024; literalbuf = (char *) palloc(literalalloc); startlit(); -- 2.39.5