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



  • 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.


  • Qt Champions 2016

    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?


  • Qt Champions 2016

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.