logo       
Bookmark and Share

Re: more on additional optimization: msg#00001

audio.supercollider.devel

Subject: Re: more on additional optimization


On Jul 31, 2004, at 7:12 AM, Ronald J. Kuivila wrote:

Hi again,


The problem with this optimization is that creating the closure object
is more overhead than the if statement.


I think my previous reply was too vague. My question was, if the
'if' is faster, can't you make a special primitive to encapsulate:

Stream-nextNotNil { arg event, func; var inEvent
if ((inEvent = this.next(event).notNil,
{^inEvent}, func);
}

As a specialized 'if' (i.e. using whatever branching magic makes if fast)?

RJK


You can't write a primitive that requires dispatching to a method within it. A primitive truly must be a primitive operation.
I don't think there is much to be gained here anyway. Eliminating the extra Routines being created at each level was a huge savings. This is peanuts.
You may not realize how your change actually helped. The major gain from your fix was not really that it saved executing more byte codes, it was eliminating time spent in the garbage collector due to allocating the 512 slot stacks for each new Routine. By embedding method calls rather than Routines, fewer Routines get allocated and so less scanning needs to be done in the GC.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise