[Qgis-developer] STL vs. Qt containers

Tim Sutton tim at linfiniti.com
Sun Oct 29 09:22:34 EST 2006


Hi

My suggestion - for timing critical things, use stl containers inside  
methods, but dont pass them accross the method interface.

Tim
On 28/10/2006, at 22:52, Mateusz Loskot wrote:

> I'd like also to suggest to measure performance of QT and STL  
> containers
> with basic algorithms.
>
> What QT is supposed to be used, 4.1 or 4.2?
>
> For example, in QT 4.1 there is no QSet::find algorithm,
> so iterator-based searching is
> - 16 times slower in searching for present value (100000)
> - 56 times slower in searching for not present value in a set (600000)
>
> // myqset contains values from 0 to 399999
> int n = 0;
> int idle = 100000;
> QSet<int>::const_iterator end = myqset.end();
> for (QSet<int>::const_iterator it = myqset.begin(); it != end; ++it)
> {
>    if (idle == *it)
>       n = *it;
> }
>
> than dedicated find algorithm for tree structures (std::set and
> std::map) in STL:
>
> // myset contains values from 0 to 399999
> int n = 0;
> int idle = 100000;
> set<int>::const_iterator pos = myset.find(idle);
> if (myset.end() != pos)
>    n = *pos;
>
>
>
> If QGIS is supposed to work with all QT 4.x versions, then it's
> required to use old API, compatible with all versions and it's not
> possible to use ie. QSet::find algorithm.
> That may increase performance significantly and 4.2 users won't be  
> able
> to use new and robust versions because QGIS needs to work with QT  
> 4.1, etc.
> Such problems does not exist if STL is used.
>
> I'm just trying to point as much issues as possible, that I believe
> should be considered before making decision to move to QT containers
> completely.
> I think, simple voting is a bad idea :-) because it's about  
> engineering,
> so measurements are the only way to select one solution over another.
>
> Cheers
> -- 
> Mateusz Loskot
> http://mateusz.loskot.net
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.qgis.org
> http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer

-- 
Tim Sutton

Visit http://qgis.org for a great Open Source GIS
Home Page: http://linfiniti.com
Skype: timlinux
MSN: tim_bdworld at msn.com
Yahoo: tim_bdworld at yahoo.com
Jabber: timlinux
Irc: timlinux on #qgis at freenode.net



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20061029/9091ef62/attachment.html


More information about the Qgis-developer mailing list