Hi all,

I need to read a big amount of data (more then 30MB) from an external application and process it. The problem is that the external application execution time is:

$ time data_producer >> /dev/null
3.27user 0.12system 0:03.39elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+15239minor)pagefaults 0swaps

While, reading with QProcess with the slot connected to readyReadStdout() signal empty, so to have maximum theoretical speed:

void DataLoader:n_readyReadStdout() { }

The time is more then doubled to almost 7s.


The real WORKING slot used is actually:

void DataLoader:n_readyReadStdout() {

// we use a circular buffer to store data chunks from loading process
QByteArray* b = new QByteArray(proc.readStdout()); // copy c'tor uses shallow copy
buffersRing.insert(buffersRingHead, b);

if (++buffersRingHead == BUF_RING_SIZE)
buffersRingHead = 0;
}

Where:
QPtrVector<QByteArray> buffersRing;

Then, on an indipendent timer I process the buffers. The circular buffer storing is quite fast, about 5% of total time, and very difficult to make faster IMHO.

So my question is, there is a faster way to load data, as example tweaking the read pipe? In this case how I have to do?

Thanks
Marco

P.S: I have Qt 3.3.6