PDA

View Full Version : QObject overhead



sriky27
30th September 2009, 19:08
Hi,

Could anyone tell me how much would be QObject overhead in terms of
a. memory
b. performance, speed

Could any suggest how to calculate it

-Sriky

wysota
30th September 2009, 19:12
QObject adds a few virtual methods and the whole P-IMPL infrastructure. To calculate memory overhead, you'd have to calculate sizeof(QObject)+sizeof(QObjectPrivate) but the latter is inaccessible from public code so you have to calculate it manually. As for performance, you can make a simple benchmark using Q_BENCHMARK. A single QObject doesn't give much overhead but if you have thousands of them, the overhead starts to be significant especially during creation and destruction.