Results 1 to 6 of 6

Thread: Fastest data structure to store large no of coordinate points

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Fastest data structure to store large no of coordinate points

    Quote Originally Posted by shivendra46d View Post
    For this i used QVector, but now the problem is that time taken in inserting values in vector is very large , so can any body tell me a fast and reliable data structure
    QVector is fine. If you know the number of points before you start you can call QVector::resize() once only. You incur only a single memory allocation and construction, rather than multiples as you grow the vector. Access is then random and does not involve memory reallocations.

    If you have an idea of the maximum size then call reserve() once and grow the vector only by appending. This avoids memory reallocations.

    If you are inserting in the middle then QVector is not right for you (or your algorithm should be rethought).

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

    wagmare (3rd December 2013)

Similar Threads

  1. fastest way to read large files (with mixed content)
    By timmu in forum Qt Programming
    Replies: 8
    Last Post: 10th September 2012, 10:09
  2. Fastest way to transfer Data over tcp
    By Qiieha in forum General Programming
    Replies: 21
    Last Post: 29th July 2012, 18:11
  3. Replies: 2
    Last Post: 12th May 2011, 07:30
  4. Replies: 1
    Last Post: 10th November 2010, 06:32
  5. Replies: 1
    Last Post: 17th July 2009, 08:22

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.