[Qt-interest] performance issue

João Abecasis joao at trolltech.com
Fri Jan 8 11:31:32 CET 2010


On 1/8/2010 9:02 AM, Daniel Bowen wrote:
> There are other things like using QXmlStreamReader, where the normal thing
> is to use atEnd in a loop.  Doesn't that end up triggering QFile::atEnd?
> Could atEnd be made more efficient for more cases?

It can be made more efficient by caching whether the last read reached 
the end of the file, although that changes semantics. Any applications 
using atEnd to determine whether data was appended to a file would break.

I'm inclined to make this change given the widespread use of 
while(!atEnd()) loops even in our codebase. It could be argued that the 
only way to really know whether more data is available is to actually 
try to read it.

I guess those are the trade-offs.

Cheers,


João






More information about the Qt-interest-old mailing list