Ok, so here a few profilings (all done with 100000 calls): 1.) This is libbonobo/tests/test-event-source compiled without optimization:
Function Name calls func% func(ms) f+c% f+c(ms) bonobo_closure_invoke_va_list 800000 45.575 13453 57.339 16925 bonobo_event_source_notify_listeners 900000 13.655 4030 96.368 28446 bonobo_marshal_VOID__STRING_BOXED_BOXED 800000 10.844 3201 11.764 3472 impl_Bonobo_Listener_event 800000 7.935 2342 69.725 20581 bonobo_object_get_type 3600048 3.064 904 3.064 904 bonobo_object_unref 900008 3.025 893 5.816 1716 bonobo_object_ref 900006 3.007 887 3.758 1109 event_match 1800000 2.052 605 2.052 605 Bonobo_Listener_event 800000 1.841 543 71.566 21125 bonobo_closure_invoke 800000 1.641 484 58.980 17410 bonobo_object_destroy 2 1.275 376 1.275 376 run_tests 1 1.197 353 97.571 28801 event_cb 800000 0.920 271 0.920 271 bonobo_object_corba_deactivate 3 0.758 223 0.758 223 bonobo_object 800015 0.730 215 0.730 215 bonobo_listener_get_type 800004 0.721 212 0.721 212 bonobo_corba_exception_get_type 800002 0.692 204 0.692 204 bonobo_corba_any_get_type 800001 0.667 196 0.667 196 bonobo_main 1 0.191 56 97.762 28858 bonobo_context_shutdown 1 0.173 51 2.207 651 bonobo_init_full 1 0.023 6 0.030 8 do_corba_setup 6 0.010 2 0.010 2 bonobo_type_setup 4 0.000 0 0.001 0 bonobo_object_finalize_servant 3 0.000 0 0.000 0 bonobo_object_finalize_internal 2 0.000 0 0.759 223 bonobo_type_unique 4 0.000 0 0.001 0 bonobo_moniker_context_new 1 0.000 0 0.003 0 bonobo_object_instance_init 6 0.000 0 0.010 2 bonobo_object_class_init 1 0.000 0 0.000 0 bonobo_running_context_new 1 0.000 0 0.004 1 main 1 0.000 0 97.793 28867 bonobo_arg_new 1 0.000 0 0.000 0 bonobo_object_release_unref 2 0.000 0 2.034 600 bonobo_listener_class_init 1 0.000 0 0.000 0 bonobo_running_context_class_init 1 0.000 0 0.000 0 bonobo_event_source_client_add_listener_full 2 0.000 0 0.004 1 bonobo_listener_new_closure 2 0.000 0 0.004 1 bonobo_event_source_new 2 0.000 0 0.003 0 context_destroy 2 0.000 0 2.034 600 POA_Bonobo_MonikerContext__init 1 0.000 0 0.000 0 impl_Bonobo_EventSource_addListenerWithMask 2 0.000 0 0.000 0 bonobo_object_query_local_interface 2 0.000 0 0.000 0 bonobo_context_add 2 0.000 0 0.000 0 bonobo_running_context_add_object 6 0.000 0 0.000 0 context_add 2 0.000 0 0.000 0 bonobo_object_dup_ref 4 0.000 0 0.000 0 get_running_info 15 0.000 0 0.000 0 impl_Bonobo_Unknown_unref 4 0.000 0 2.034 600 bonobo_running_context_remove_object 3 0.000 0 0.000 0 impl_Bonobo_Unknown_ref 4 0.000 0 0.000 0 bonobo_object_corba_objref 7 0.000 0 0.000 0 bonobo_event_source_finalize 1 0.000 0 0.000 0 running_info_destroy 1 0.000 0 0.000 0 POA_Bonobo_EventSource__init 2 0.000 0 0.000 0 bonobo_object_init 1 0.000 0 0.000 0 bonobo_poa 18 0.000 0 0.000 0 bonobo_running_context_ignore_object 3 0.000 0 0.000 0 bonobo_context_init 1 0.000 0 0.007 2 bonobo_event_source_get_type 8 0.000 0 0.000 0 bonobo_listener_init 2 0.000 0 0.000 0 bonobo_object_finalize_gobject 3 0.000 0 0.000 0 bonobo_event_source_init 2 0.000 0 0.000 0 bonobo_event_source_client_add_listener 2 0.000 0 0.004 1 bonobo_main_quit 1 0.000 0 0.000 0 bonobo_object_add_interface 1 0.000 0 0.000 0 impl_Bonobo_Unknown_queryInterface 2 0.000 0 0.000 0 bonobo_event_source_from_servant 2 0.000 0 0.000 0 POA_Bonobo_Listener__init 2 0.000 0 0.000 0 bonobo_event_source_client_add_listener_closure 2 0.000 0 0.004 1 bonobo_init 1 0.000 0 0.030 8 bonobo_activate 1 0.000 0 0.000 0 Bonobo_EventSource_addListenerWithMask 2 0.000 0 0.000 0 bonobo_moniker_context_get_type 1 0.000 0 0.001 0 check_empty 3 0.000 0 0.000 0 POA_Bonobo_RunningContext__init 1 0.000 0 0.000 0 bonobo_object_dummy_destroy 3 0.000 0 0.000 0 bonobo_running_context_get_type 1 0.000 0 0.000 0 bonobo_closure_store 2 0.000 0 0.000 0 check_destroy 1 0.000 0 0.000 0 bonobo_object_epv_init 4 0.000 0 0.000 0 bonobo_event_source_ignore_listeners 1 0.000 0 0.000 0 bonobo_event_source_class_init 1 0.000 0 0.000 0 init_vepvmap_Bonobo_MonikerContext 1 0.000 0 0.000 0 bonobo_object_tracking_shutdown 1 0.000 0 0.000 0 bonobo_orb 1 0.000 0 0.000 0 bonobo_moniker_context_init 1 0.000 0 0.000 0 init_vepvmap_Bonobo_RunningContext 1 0.000 0 0.000 0 init_vepvmap_Bonobo_Listener 1 0.000 0 0.000 0 init_vepvmap_Bonobo_EventSource 1 0.000 0 0.000 0 bonobo_running_context_init 1 0.000 0 0.000 0 bonobo_moniker_context_class_init 1 0.000 0 0.000 0
2.) Compiled with -O6:
Attachment:
logfile-3
Description: Binary data
3.) This is a small test program:
#include <config.h> #include <stdio.h> #include <string.h> #include <libbonobo.h> #include <bonobo/bonobo-marshal.h> #define PROFILE_COUNT 100000 static int idle_id; static gulong event_cb (BonoboEventSource *event_source, char *event_name, CORBA_any *any, CORBA_Environment *ev, gpointer user_data) { gulong sum, i; sum = 0; for (i = 0; i < 1000; i++) sum += i; return sum; } static void run_tests () { GClosure *closure; BonoboEventSource *es; CORBA_Environment ev; CORBA_any *value; gulong i; CORBA_exception_init (&ev); g_source_remove (idle_id); closure = g_cclosure_new (G_CALLBACK (event_cb), NULL, NULL); bonobo_closure_store (closure, bonobo_marshal_VOID__STRING_BOXED_BOXED); g_closure_ref (closure); g_closure_sink (closure); es = bonobo_event_source_new (); g_assert (es != NULL); value = bonobo_arg_new (BONOBO_ARG_LONG); BONOBO_ARG_SET_LONG (value, 512); for (i = 0; i < PROFILE_COUNT; i++) { gulong result; bonobo_closure_invoke (closure, G_TYPE_LONG, &result, BONOBO_EVENT_SOURCE_TYPE, es, BONOBO_TYPE_STRING, "test_event", BONOBO_TYPE_CORBA_ANY, value, BONOBO_TYPE_CORBA_EXCEPTION, ev, 0); } bonobo_main_quit (); } int main (int argc, char **argv) { if (!bonobo_init (&argc, argv)) g_error ("Cannot init bonobo"); idle_id = g_idle_add ((GSourceFunc) run_tests, NULL); bonobo_main (); return 0; }
Function Name calls func% func(ms) f+c% f+c(ms) bonobo_closure_invoke_va_list 100000 65.552 1700 90.756 2354 bonobo_marshal_VOID__STRING_BOXED_BOXED 100000 15.453 400 25.204 653 event_cb 100000 9.751 252 9.751 252 bonobo_init_full 1 4.125 107 4.204 109 bonobo_closure_invoke 100000 2.253 58 93.009 2412 run_tests 1 1.730 44 94.760 2458 bonobo_object_destroy 2 0.609 15 0.610 15 bonobo_object_corba_deactivate 3 0.415 10 0.416 10 do_corba_setup 4 0.072 1 0.073 1 bonobo_type_setup 3 0.006 0 0.010 0 bonobo_main 1 0.003 0 94.763 2458 bonobo_object_finalize_internal 2 0.002 0 0.419 10 bonobo_running_context_new 1 0.002 0 0.043 1 bonobo_object_get_type 25 0.002 0 0.002 0 bonobo_object_instance_init 4 0.002 0 0.076 1 bonobo_type_unique 3 0.002 0 0.012 0 bonobo_moniker_context_new 1 0.002 0 0.034 0 bonobo_object_class_init 1 0.002 0 0.003 0 main 1 0.002 0 98.969 2567 bonobo_arg_new 1 0.001 0 0.001 0 bonobo_object_release_unref 2 0.001 0 1.030 26 bonobo_corba_exception_get_type 2 0.001 0 0.001 0 bonobo_running_context_class_init 1 0.001 0 0.001 0 bonobo_event_source_new 2 0.001 0 0.038 0 bonobo_corba_any_get_type 1 0.001 0 0.001 0 POA_Bonobo_MonikerContext__init 1 0.001 0 0.001 0 bonobo_object_unref 4 0.001 0 1.029 26 bonobo_context_add 2 0.001 0 0.001 0 bonobo_context_shutdown 1 0.000 0 1.031 26 bonobo_object_finalize_servant 3 0.000 0 0.000 0 context_add 2 0.000 0 0.002 0 get_running_info 13 0.000 0 0.000 0 bonobo_running_context_add_object 4 0.000 0 0.001 0 bonobo_object_dup_ref 2 0.000 0 0.001 0 bonobo_running_context_remove_object 3 0.000 0 0.000 0 impl_Bonobo_Unknown_ref 2 0.000 0 0.000 0 impl_Bonobo_Unknown_unref 2 0.000 0 1.029 26 bonobo_object_init 1 0.000 0 0.000 0 POA_Bonobo_EventSource__init 2 0.000 0 0.000 0 bonobo_main_quit 1 0.000 0 0.000 0 running_info_destroy 1 0.000 0 0.000 0 bonobo_event_source_finalize 1 0.000 0 0.000 0 context_destroy 2 0.000 0 1.030 26 bonobo_context_init 1 0.000 0 0.079 2 bonobo_running_context_ignore_object 3 0.000 0 0.000 0 bonobo_object_finalize_gobject 3 0.000 0 0.000 0 bonobo_event_source_get_type 7 0.000 0 0.001 0 bonobo_event_source_init 2 0.000 0 0.000 0 bonobo_object_add_interface 1 0.000 0 0.000 0 bonobo_object_corba_objref 3 0.000 0 0.000 0 bonobo_poa 14 0.000 0 0.000 0 bonobo_object_ref 2 0.000 0 0.000 0 bonobo_activate 1 0.000 0 0.000 0 check_empty 3 0.000 0 0.000 0 bonobo_init 1 0.000 0 4.204 109 bonobo_arg_type_is_equal 1 0.000 0 0.000 0 POA_Bonobo_RunningContext__init 1 0.000 0 0.000 0 bonobo_object 7 0.000 0 0.000 0 bonobo_running_context_get_type 1 0.000 0 0.002 0 bonobo_moniker_context_get_type 1 0.000 0 0.009 0 bonobo_object_epv_init 3 0.000 0 0.000 0 bonobo_event_source_ignore_listeners 1 0.000 0 0.000 0 bonobo_event_source_class_init 1 0.000 0 0.000 0 bonobo_object_dummy_destroy 3 0.000 0 0.000 0 bonobo_closure_store 1 0.000 0 0.000 0 check_destroy 1 0.000 0 0.000 0 init_vepvmap_Bonobo_MonikerContext 1 0.000 0 0.000 0 bonobo_object_tracking_shutdown 1 0.000 0 0.000 0 bonobo_moniker_context_init 1 0.000 0 0.000 0 bonobo_moniker_context_class_init 1 0.000 0 0.000 0 init_vepvmap_Bonobo_EventSource 1 0.000 0 0.000 0 init_vepvmap_Bonobo_RunningContext 1 0.000 0 0.000 0 bonobo_orb 1 0.000 0 0.000 0 bonobo_running_context_init 1 0.000 0 0.000 0
-- Martin Baulig martin gnome org (private) baulig suse de (work)