Skip to content
Snippets Groups Projects
Commit 70868c01 authored by Tom Lane's avatar Tom Lane
Browse files

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.
parent ae65ca31
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/lib/stringinfo.c,v 1.46 2007/05/28 16:43:24 tgl Exp $ * $PostgreSQL: pgsql/src/backend/lib/stringinfo.c,v 1.47 2007/08/12 20:18:06 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -45,7 +45,7 @@ makeStringInfo(void) ...@@ -45,7 +45,7 @@ makeStringInfo(void)
void void
initStringInfo(StringInfo str) initStringInfo(StringInfo str)
{ {
int size = 256; /* initial default buffer size */ int size = 1024; /* initial default buffer size */
str->data = (char *) palloc(size); str->data = (char *) palloc(size);
str->maxlen = size; str->maxlen = size;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.139 2007/01/05 22:19:34 momjian Exp $ * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.140 2007/08/12 20:18:06 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -820,7 +820,7 @@ scanner_init(const char *str) ...@@ -820,7 +820,7 @@ scanner_init(const char *str)
scanbufhandle = yy_scan_buffer(scanbuf, slen + 2); scanbufhandle = yy_scan_buffer(scanbuf, slen + 2);
/* initialize literal buffer to a reasonable but expansible size */ /* initialize literal buffer to a reasonable but expansible size */
literalalloc = 128; literalalloc = 1024;
literalbuf = (char *) palloc(literalalloc); literalbuf = (char *) palloc(literalalloc);
startlit(); startlit();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment