Hi Anton,
it seems we started digging too deep into technical details.
Let's talk about it "privetly".
But you correctly noticed that Qt call mechanism should be more efficient just because:
TQObject:Emit => TQConnection::ExecuteMethod => G__CallFunc::Exec => pointer_to_func
and check analog of TQObject:Emit in Qt:
QObject::activate_signal => ... => pointer_to_func
Regards. Valeriy
++
Signal-Slots communication mechanism getting more popular.
Another implementation of it based on templates was appeared recently.
Check http://libsigc.sourceforge.net/ Thanks to Brett Viren for reference.
Anton Fokin wrote:
>
> Hi Valery,
>
> I meant that Emit("DataChanged()") call might be time consuming since you
> take an argument as char string, compress it and loop over class and object
> signal/connection lists (why don't you use hash table, btw?). I was curious
> how it is done in Qt/moc. If you say it does nearly the same, no probs. A
> benchmark test could be like
>
> while (end_test) {
> DataChanged();
> }
>
> with and without Emit() in DataChanged(). Of course nobody should be
> connected to this signal. On the other hand result will depend on how long
> are lists of signals...
>
> > > I am also not sure what it takes in Qt/moc. In Qt you do not need to
> call
> > > Emit() in a signal method - the signal will be emitted automatically
> once
> > > the method is declared as signal.
> > >
> >
> > ("It is not correct ..." Valery Fine;)
> >
> >
> > I studied Qt code ... it also uses "Emit" method inside "signal"
> > Suppose looking at the code produced after MOC preprocessor will reveal
> it.
> > > I am also not sure what it takes in Qt/moc. In Qt you do not need to
> call
> > > Emit() in a signal method - the signal will be emitted automatically
> once
> > > the method is declared as signal.
> > >
> >
> > ("It is not correct ..." Valery Fine;)
> >
> >
> > I studied Qt code ... it also uses "Emit" method inside "signal"
> > Suppose looking at the code produced after MOC preprocessor will reveal
> it.
>
> Yes, that was the questions. I meant that a user does not need to put Emit()
> in the body of a signal method in Qt - moc does it. I asked if it is done in
> a clever way since moc has control over the code and can make some "direct"
> substitutions.
>
> Regards,
> Anton
>
> http://www.smartquant.com
>
> ----- Original Message -----
> From: Valeriy Onuchin <onuchin@fnal.gov>
> To: Anton Fokin <anton.fokin@smartquant.com>
> Cc: <roottalk@pcroot.cern.ch>
> Sent: Thursday, March 22, 2001 11:27 PM
> Subject: Re: [ROOT] TQObject::Emit()
>
> > Hi Anton,
> >
> > Anton Fokin wrote:
> >
> > >
> > >
> > > Hi,
> > >
> > > If I want to use singal/slots I have to add Emit("DataChanged()"); or
> alike
> > > in my TQObject inherited class method to emit a signal. I am curious if
> this
> > > call is costly or not.
> >
> > What cost do you mean?
> >
> > Memory?
> >
> > TQObject has 2 data members which are pointers to
> Lists( sizeof(TList*) = 4 ).
> > These TLists are created(new TList) only when connection is
> established
> > ( sizeof(TList) = 44 ). During creation of connection some internal
> structures
> > are also initiated, but it was designed to make it minimal amd reuses
> existent ones.
> >
> >
> > >
> > >
> > > I am also not sure what it takes in Qt/moc. In Qt you do not need to
> call
> > > Emit() in a signal method - the signal will be emitted automatically
> once
> > > the method is declared as signal.
> > >
> >
> > ("It is not correct ..." Valery Fine;)
> >
> >
> > I studied Qt code ... it also uses "Emit" method inside "signal"
> > Suppose looking at the code produced after MOC preprocessor will reveal
> it.
> >
> >
> >
> > >
> > > So could you comment on performance of Emit("DataCahnged()") decoding
> (with
> > > CINT dict, etc.) compare to Qt moc processing.
> >
> > Fair comparison of benchmark tests is always difficult task
> > ( btw it's not a bad business
> http://www.tpc.org/information/about/join.asp )
> >
> > Suggest the "fair test" and I/we can try it.
> >
> >
> > Regards. Valeriy
> >
> >
> >
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:40 MET