1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Replace pq_getbytes(&ch, 1) calls with pq_getbyte(), which is easier

to use and significantly faster.  This tweak saves 25% (!) of the runtime
of COPY IN in a test with 8000-character lines.  I wouldn't normally
commit a performance improvement this late in the cycle, but 25% got
my attention...
This commit is contained in:
Tom Lane
2001-12-04 19:40:17 +00:00
parent dae887abfe
commit f4bd04bb67
4 changed files with 20 additions and 25 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.142 2001/10/25 05:49:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.143 2001/12/04 19:40:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -157,13 +157,10 @@ CopyGetChar(FILE *fp)
{
if (!fp)
{
unsigned char ch;
int ch = pq_getbyte();
if (pq_getbytes((char *) &ch, 1))
{
if (ch == EOF)
fe_eof = true;
return EOF;
}
return ch;
}
else
@ -209,12 +206,9 @@ CopyDonePeek(FILE *fp, int c, int pickup)
if (pickup)
{
/*
* We want to pick it up - just receive again into dummy
* buffer
* We want to pick it up
*/
char c;
pq_getbytes(&c, 1);
(void) pq_getbyte();
}
/* If we didn't want to pick it up, just leave it where it sits */
}