[asterisk-dev] Re: [asterisk-commits] rizzo: trunk r47132 - in /trunk: include/asterisk/manager.h main/manager.c

Luigi Rizzo rizzo at icir.org
Fri Nov 3 14:31:25 MST 2006


On Fri, Nov 03, 2006 at 02:54:31PM -0600, Kevin P. Fleming wrote:
> asterisk-commits at lists.digium.com wrote:
> > It is not worthwhile having this as a compile time option
> > right now, because the extra work involved at runtime is
> > just checking one variable.
> 
> I don't think I agree. You are forcing every call to manager_event to
> push more arguments on the stack, and then throwing them away if debug
> is not enabled.

yes, but that is still 2-3 orders of magnitude less than the cost
of manager_event() itself.  Just look at how expensive is everything
around this call...  at least one sprintf-equivalent, one
strcat-equivalent, a lock and an unlock just within the manager_event(),
followed by a strcpy at the end in append_event.  And the caller
does another large sprintf.

look at the good side: you don't have to play with macros to
maintain two different versions of the function... and also,
recently i changed append_event so that now it is O(1) instead
of O(n). that certainly saves a lot more cpu cycles.

	cheers
	luigi


More information about the asterisk-dev mailing list