Results 1 to 3 of 3

Thread: What should be the fastest QList operation?

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default What should be the fastest QList operation?

    Hello!

    This is a quesiton similar to this old one: http://www.qtcentre.org/threads/5927...ation?p=263368

    What should be the fastest operation to make? (provided that the QList is at least a little big, lets say 100 items or more)


    1. QList::reserve()
    2. QList::resize()
    3. QList::insertAt()

    vs.

    1. QList::reserve()
    2. QList::append() repeatedly, till QList::size() == reserved
    May the Lord be with you. Always.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: What should be the fastest QList operation?

    First of all there is no resize() in QList. Second of all when appending QList behaves the same was as QVector. Third of all, RTFM: http://doc.qt.digia.com/qq/qq19-containers.html
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: What should be the fastest QList operation?

    Quote Originally Posted by wysota View Post
    First of all there is no resize() in QList.
    Oh, my mistake! Sorry! :S (I guess I did a confusion because the source code from which I took the question has both a QVector and a QList implemented)

    Quote Originally Posted by wysota View Post
    RTFM
    Well, that was a documentation I never heard about; thanks for the link! (Btw wouldn't there be any Qt5 changes that could invalidate part of this article?)

    Thanks,

    Momergil
    May the Lord be with you. Always.

Similar Threads

  1. What's the fastest QVector operation
    By Momergil in forum Qt Programming
    Replies: 5
    Last Post: 30th May 2014, 17:22
  2. Fastest way to transfer Data over tcp
    By Qiieha in forum General Programming
    Replies: 21
    Last Post: 29th July 2012, 19:11
  3. Replies: 4
    Last Post: 20th August 2010, 14:54
  4. Fastest PaintDevice?
    By rage in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 8th November 2007, 16:46
  5. Fastest way to clear a QList
    By steg90 in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2007, 10:26

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.