Re: more on additional optimization
James McCartney <
asynth@...>
2004-08-01 00:22:11 GMT
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.
(Continue reading)