Results 1 to 3 of 3

Thread: Foreach performance

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: Foreach performance

    Quote Originally Posted by jano_alex_es View Post
    Foreach seems to be the answer... but it makes a copy, so it needs extra memory.
    Yes, but since most of the Qt classes uses implicit sharing it isn't a problem. Just make sure you use const! this will save a lot of time.
    And if that is still to slow for you, use const STL-style iterators, they are the fastest. And if you think that your source code is unreadable with STL iterators, make a quick benchmark on your device and see if they are really quicker.

  2. The following user says thank you to Lykurg for this useful post:

    jano_alex_es (17th November 2009)

  3. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: Foreach performance

    read this post, but it deals with Qt classes.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  4. The following user says thank you to spirit for this useful post:

    jano_alex_es (17th November 2009)

Similar Threads

  1. QGraphicsView performance in 4.6
    By Lodorot in forum Qt Programming
    Replies: 2
    Last Post: 20th September 2009, 23:09
  2. Performance trouble in Graphics View
    By zgulser in forum Qt Programming
    Replies: 8
    Last Post: 14th September 2009, 22:11
  3. QT core lib performance?
    By Quentin in forum Qt Programming
    Replies: 1
    Last Post: 31st January 2009, 09:17
  4. Performance Issues in Qt-4.4.3 / Qwt-5.1.1
    By swamyonline in forum Qt Programming
    Replies: 2
    Last Post: 25th January 2009, 17:50
  5. Qt4 poor printing performance
    By seneca in forum Qt Programming
    Replies: 4
    Last Post: 22nd January 2009, 14:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.