[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: QPtrList documentation
From:       Jeroen Wijnhout <Jeroen.Wijnhout () kdemail ! net>
Date:       2003-07-15 13:29:56
[Download RAW message or body]

On Tuesday 15 July 2003 12:33, Adriaan de Groot wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> [This applies to the docs of Qt 3.x; I haven't got a copy of Qt 2.x to
> check the history. And it's pretty darn trivial.] In qptrlist.html, the
> example code in the "Detailed Description" section contains this:
>
>     // very inefficient for big lists
>     for ( uint i = 0; i < list.count(); ++i )
>         if ( list.at(i) )
>             cout << list.at( i )->surname().latin1() << endl;
>
> while the documentation for QPtrList::at() states
>
> This function is very efficient. It starts scanning from the first item,

Just my two cents:

Isn't the cout causing the inefficiency? Printing a large number of lines to 
stdout this way is very inefficient. Try redirecting stdout on the 
command-line to a file and measure the time difference.

best,
Jeroen
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic