[Development] RFC: banning _q_slot() in favour of new-style connect()?

Marc Mutz marc.mutz at kdab.com
Fri Oct 12 17:54:53 CEST 2012


On Friday October 12 2012, Thiago Macieira wrote:
> > Not harder to use than Q_PRIVATE_SLOT, IMO. More annoying, yes, because
> > of boilerplate code (of which Q_PRIVATE_SLOT also has some, mind).
> > Real-life example:
>
> [snip]
>
> I'd rather explore options like what Olivier is proposing. The functors, as
> you showed, all need to keep a pointer to the original object, which
> QObjectPrivate already carries.

Yes, I like that interface better, too. However, the function pointers 
apparently cause a lot of extra text to be emitted which the functor version 
doesn't have because of inlining into the QSlotObjectBase (guessing here). In 
one version, I was able to _reduce_ the text size of the functor solution 
wrt. the original Q_PRIVATE_SLOT version.

If we could get the overhead of Olivier's interface down to zero or even 
negative (as proven possible), then I'd be all for it, but I think the 
penalty is too high with the current implementation, in particular if there 
are only a few slots in a class. The itemmodels change is a very favourable 
pick, I think, but still generates 5.5k of additional text, while 
saving "only" 2.5k of data:

   text    data     bss     dec     hex filename
4113990  125672    5240 4244902  40c5a6 lib/libQtCore-conn.so.5.0.0
4108452  128296    5240 4241988  40ba44 lib/libQtCore-orig.so.5.0.0

But removing the Compare operation (which will likely break disconnect?) and 
overloading connect() for presence of the fifth argument only reduces text 
size by 500 bytes, so I'm out of ideas.

Thanks,
Marc

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions



More information about the Development mailing list