From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Brent Ewing <bge(at)u(dot)washington(dot)edu> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: repeated pointless memmove() calls in pqReadData() |
Date: | 2001-05-28 15:34:00 |
Message-ID: | 12791.991064040@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Brent Ewing <bge(at)u(dot)washington(dot)edu> writes:
> Second, I am puzzled by repeated, apparently pointless calls to memmove() in
> the function pqReadData, which is in `src/interfaces/libpq/fe-misc.c'.
Hm. That was never a problem back when we had an 8K row-size limit ;-)
but I can see that it might get to be an issue for retrieving huge rows.
Thanks for the suggestion. I've applied the attached patch to current
sources.
regards, tom lane
*** fe-misc.c~ Sat Mar 31 18:13:30 2001
--- fe-misc.c Mon May 28 11:29:51 2001
***************
*** 400,413 ****
/* Left-justify any data in the buffer to make room */
if (conn->inStart < conn->inEnd)
{
! memmove(conn->inBuffer, conn->inBuffer + conn->inStart,
! conn->inEnd - conn->inStart);
! conn->inEnd -= conn->inStart;
! conn->inCursor -= conn->inStart;
! conn->inStart = 0;
}
else
conn->inStart = conn->inCursor = conn->inEnd = 0;
/*
* If the buffer is fairly full, enlarge it. We need to be able to
--- 400,419 ----
/* Left-justify any data in the buffer to make room */
if (conn->inStart < conn->inEnd)
{
! if (conn->inStart > 0)
! {
! memmove(conn->inBuffer, conn->inBuffer + conn->inStart,
! conn->inEnd - conn->inStart);
! conn->inEnd -= conn->inStart;
! conn->inCursor -= conn->inStart;
! conn->inStart = 0;
! }
}
else
+ {
+ /* buffer is logically empty, reset it */
conn->inStart = conn->inCursor = conn->inEnd = 0;
+ }
/*
* If the buffer is fairly full, enlarge it. We need to be able to
From | Date | Subject | |
---|---|---|---|
Next Message | Trond Eivind =?iso-8859-1?q?Glomsr=F8d?= | 2001-05-28 18:02:27 | "pg_ctl restart" in 7.1.2 |
Previous Message | Peter Eisentraut | 2001-05-28 14:48:35 | Re: Compilation --with-python fails on Solaris 8 |