Re: Creation of many components & time



       
Hi,

On Wed, 24 Jan 2001 monkeyiq dingoblue net au wrote:
> I would suspect that the gtk+ new object stuff may be lagging the code
> here. I will prolly benchmark raw gtk+ object creation vs bonobo
> component creation

        The Gtk stuff should be fast.

> to check this out. At any rate it seems that there are *many* orders
> of magnitude in speed diff between creating a C++ object and creating
> a bonobo component. I haven't benchmarked ActiveX on a machine like
> this one, so I can not draw cross performance figures ... but I think
> that such data would be interesting as it seems that one can not have
> 1000 components in any light to medium weight bonobo app at the
> moment.
   
        Ok; this is because of how you are activating them:
         
> This was creating 1000 echo components with code like:

        This is not a good way to do it:

> void
> benchmark( int number_to_make )
> {
>  BonoboObjectClient *server; 
>  Demo_Echo           echo_server;
>  CORBA_Environment   ev;
>  char               *obj_id;
>  int i = 0;   
> 
>  obj_id = "OAFIID:Bonobo_Sample_Echo";
> 
> 
>  for( i = 0; i < number_to_make; i++ )
>  {
>
>   server = bonobo_object_activate (obj_id, 0);
>   if (!server) {
>    printf ("Could not create an instance of the %s component", obj_id);
>    return 1;
>   }
>   echo_server = bonobo_object_corba_objref (BONOBO_OBJECT (server));
>                        
>
>   if(!(i%100)) {
>    printf("i is at %d\n",i);
>   }
>  }     
>     
> }

        When you do 'bonobo_object_activate' you do an
oaf_activate_from_id which is garenteed to go out of process to the oafd [
and then for a shlib component back to your processes ]
        
        Instead you should probably do:

GNOME_ObjectFactory factory = oaf_activat_from_iid ("OAFIID:OfFactory",0);

        Then you can do:

Bonobo_Unknown new_object = GNOME_ObjectFactory_create_object (
        factory, "OAFIID:TheObjectId", a stringlist, 0);

        And this will be extremely fast.

> >         So the overhead is ~0 after factory activation.
> 
> Well, I would assume that it would be slower because of stubs, and
surely the

        For in-proc here is the stub overhead:
   
void Bonobo_Stream_write(Bonobo_Stream _obj,
                         const Bonobo_Stream_iobuf *buffer,
                         CORBA_Environment * ev)

   if (_obj->servant && _obj->vepv && Bonobo_Stream__classid) {

         ((POA_Bonobo_Stream__epv *) _obj->vepv[Bonobo_Stream__classid])->
         write(_obj->servant, buffer, ev);
      return;
   }

        ie. 3 compares and another stack frame ~= 0.

> CORBA_alloc() - free() stuff when passing args... not that any of this
> CORBA stuff can be helped :-)

        None of that should be needed really.
  
        Regards,

                Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]