Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Strategy for storing an array of thousands of objects read from JSON
Forum Updated to NodeBB v4.3 + New Features

Strategy for storing an array of thousands of objects read from JSON

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 525 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tjudg
    wrote on last edited by
    #1

    I have to store an array with 10,000 objects. Each object will have 5 entries. I have done something similar before but with only 30 objects inside the array. At that time I used a QList<struct> to store all the data but now with a lot more objects, I'm worried about the impact it will have on the performance of my program. I will have to store all the objects in a container and access the objects and the objects' entries multiple times quickly.

    What are some good containers and good data structures to use for this? I'm fine with using containers/data structures provided by qt, in stl, in boost, or in any other 3rd party library.

    kshegunovK 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      I think it depends on how you need to access it.
      How do you locate a given object ?

      I mean do you need to search for a matching key
      or how do you find its index in the QList ?

      Also what is the target platform?

      1 Reply Last reply
      1
      • T tjudg

        I have to store an array with 10,000 objects. Each object will have 5 entries. I have done something similar before but with only 30 objects inside the array. At that time I used a QList<struct> to store all the data but now with a lot more objects, I'm worried about the impact it will have on the performance of my program. I will have to store all the objects in a container and access the objects and the objects' entries multiple times quickly.

        What are some good containers and good data structures to use for this? I'm fine with using containers/data structures provided by qt, in stl, in boost, or in any other 3rd party library.

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by kshegunov
        #3

        QVector for sequential access. QHash/QSet (basically the same thing) for non-sequential access but you need to provide a hashing function.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved