Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Strategy for storing an array of thousands of objects read from JSON
tjudg last edited by
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.
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?
QVectorfor sequential access.
QSet(basically the same thing) for non-sequential access but you need to provide a hashing function.