Results 1 to 2 of 2

Thread: fastest access Qt array for double?

  1. #1
    Join Date
    Aug 2009
    Posts
    122
    Thanks
    74
    Qt products
    Qt4
    Platforms
    Windows

    Question fastest access Qt array for double?

    I need to access a 2D array (matrix) a large number of times. What Qt class offers the fastest access 2D array for double? Is QVector a good choice or QLlinkedList? Speedwise, how do they measure up against C's "malloc" in terms of access speed?

    I don't know the size of my matrix until the code starts to build it. So, it would be great if it could be built dynamically without predefining its dimensions.

  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: fastest access Qt array for double?

    QVector is as fast as a plain C array since data is indeed kept as a C array internally. QLinkedList doesn't allow indexed access so it will be a bit slower (if you only need sequential access) or horribly slower (if you need random access). If you're after speed and you know the size of the data upfront (I mean when creating the array, not when running the program), use a plain C array.
    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. The following user says thank you to wysota for this useful post:

    timmu (3rd October 2012)

Similar Threads

  1. Fastest way to transfer Data over tcp
    By Qiieha in forum General Programming
    Replies: 21
    Last Post: 29th July 2012, 18:11
  2. Replies: 3
    Last Post: 17th April 2012, 09:09
  3. Program not finding an existing double in a QList<double>
    By aarelovich in forum Qt Programming
    Replies: 2
    Last Post: 9th May 2011, 20:59
  4. read a .txt file and store it in a double array
    By fatecasino in forum Newbie
    Replies: 5
    Last Post: 3rd December 2010, 20:13
  5. Fastest PaintDevice?
    By rage in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 8th November 2007, 15:46

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.