[Cuis-dev] Why is this slower?

Luciano Notarfrancesco luchiano at gmail.com
Sun May 24 04:32:26 PDT 2026


I have a class that implements a one pole filter, with instance variables
pole and y (the last output). It implements

value: in
    ^ y := (1.0 - pole) * in + (pole * y)

The following implementation is equivalent, but uses one less arithmetic
operation:

value: in
    ^ y := (y - in) * pole + in

I was surprised to find out that the second implementation is 35% slower
(measured with BlockClosure>>bench). From just looking at the bytecodes
naively, it looks like a "pushTemp: 0" is much slower than a
"pushRcvr: 0" + a "pushConstant: 1.0" + "send: *". Anyone know what's
exactly going on? Is there an easy way to print the generated native code?
I'm just curious, not a big deal.

Thanks,
Luciano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20260524/a3bbc067/attachment.htm>


More information about the Cuis-dev mailing list