[Qt-interest] using QObject's for object-relational mapping system
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Thu Jan 15 11:31:45 CET 2009
Dmitry wrote:
> Hi!
> I'm considering to implement ORM based on qt object system; It
> means storing collections of thousands (or more) of QObject
> descendands
> with Q_OBJECT and Q_PROPERTY macros and serialization/de- of
> such objects
> based on QMetaClassInfo/Property;
> How could this solution be resource-intense and what magnitudes of
> QObjects could I operate this way?
Hi Dmitry,
Resource-wise, it depends on how the objects are going to be used once they
are loaded.
I can't find the reference, but I recall someone saying on this list that
QObject's are heavy-weight in terms of construction and destruction. So if
the objects are fairly static (like Qt's widgets), then the performance hit
is negligible in release configurations. But, if the objects are going to be
used as temporaries for intensive calculations, then the overhead will
noticeably slow things down.
Memory-wise, it would be best to generate a million objects, using whatever
features (signals, children, etc.) are expected. Then measure it with
Valgrind.
Note that Qt does NOT use QObject as the base for QGraphicsItems, and lots
of other worker objects.
Regards,
Tony Rietwyk
More information about the Qt-interest-old
mailing list