Thread (39 messages) 39 messages, 7 authors, 2016-08-11

Re: [RFC \ WISH] Add -o option to git-rev-list

flat view

From: Marco Costalba <hidden>
Date: 2016-08-11 20:08:28

On 12/15/06, Linus Torvalds [off-list ref] wrote:

On Fri, 15 Dec 2006, Marco Costalba wrote:
quoted
Warmed-up cache
QProcess 7632ms (500ms data read interval)
QProcess 7972ms (100ms data read interval)
Why do you even bother posting numbers, when multiple people have told you
that the numbers you post are meaningless?

As long as you throttle the writer by not reading data in a timely fashion
(by using poll() or select() in the main loop and reading when it's
available), and you continue to talk about "data read intervals", all your
numbers are CRAP.
QProcess implementation is like this FWIK (from
qt-x11-free-3.3.4/src/kernel/qprocess_unix.cpp):

The SIGCHLD handler writes to a socket to tell the manager that
something happened. Then in  QProcessManager::sigchldHnd() data is read by

process->socketRead( proc->socketStdout );


In QProcess::socketRead() a call to C function read() is done to get
4KB of data:

const int basize = 4096;
QByteArray *ba = new QByteArray( basize );
n = ::read( fd, ba->data(), basize );


The pointer ba is then appended to a pointer list.

This happens _ALWAYS_ indipendently of _how_ the application calls the
Qt library for reading.

When application read recieved data with QProcess::readStdout(), then
data stored in buffers pointed by the pointer list is memcpy() to a
temporary array that is the return value of QProcess::readStdout().
See in qt-x11-free-3.3.4/src/kernel/qprocess.cpp:

QByteArray QProcess::readStdout()
{
   if ( readStdoutCalled ) {
	return QByteArray();
   }
   readStdoutCalled = TRUE;
   QMembuf *buf = membufStdout();
   readStdoutCalled = FALSE;

   return buf->readAll();  // here a memcpy() is involved
}


So it' true that we use a timeout, but only to trigger a memcpy() from
Qt internal library buffers that, instead are feeded as soon as
possible by Qt implementation.

IOW the timely select() is already done by Qt library. We just read
what has been already received and stored.

  Marco
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help