[Qt-interest] performance issue
João Abecasis
joao at trolltech.com
Thu Jan 7 16:54:38 CET 2010
João Abecasis wrote:
> Btw, did you try opening the device in Unbuffered mode as well? From
> inspecting the code, it seems that Qt may be doing double-buffering
> otherwise (once by Qt itself and again by using standard streams) :-/ --
> I should fix this...
I looked some more into this issue and the double-buffering is indeed an
issue that can explain the decrease in readLine performance.
Double-buffering started in Qt 4.3.0. I just committed a fix for it in
the 4.6 branch.
Contrary to my earlier suggestion, switching to Unbuffered mode won't
really help, quite the contrary: readLine would default to
byte-at-a-time reads.
A more proper workaround would be:
QFile fileHandle("file.txt");
if (fileHandle.open(QIODevice::ReadOnly | QIODevice::Unbuffered) {
QFile file;
// shouldn't fail
file.open(fileHandle.handle(), QIODevice::ReadOnly);
}
Cheers,
João
More information about the Qt-interest-old
mailing list