Re: repeated pointless memmove() calls in pqReadData()
От | Tom Lane |
---|---|
Тема | Re: repeated pointless memmove() calls in pqReadData() |
Дата | |
Msg-id | 12791.991064040@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | repeated pointless memmove() calls in pqReadData() (Brent Ewing <bge@u.washington.edu>) |
Список | pgsql-bugs |
Brent Ewing <bge@u.washington.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
В списке pgsql-bugs по дате отправления: