Closed primo-ppcg closed 1 year ago
Here are my numbers:
master (ee01045d):
$ JANET_PATH=~/src/spork/jpm_tree/lib ~/src/janet/build/janet ~/scratch/min-max.janet
min 1.000s, 13.23µs/body
max 1.000s, 13.04µs/body
min-of 1.000s, 12.67µs/body
max-of 1.000s, 12.57µs/body
extreme 1.000s, 12.6µs/body
branch (6e897933):
$ JANET_PATH=~/src/spork/jpm_tree/lib ~/src/janet.primo-ppcg/build/janet ~/scratch/min-max.janet
min 1.000s, 3.313µs/body
max 1.000s, 3.18µs/body
min-of 1.000s, 2.767µs/body
max-of 1.000s, 2.679µs/body
extreme 1.000s, 12.37µs/body
Test from various repositories were fine too :+1:
Here are my numbers:
Appreciated, as always 😄
Creates a helper macro so that the primitive comparators compile to vm ops directly. The boiler plating is approximately the same as would be generated by
each
, except that the key is advanced before the loop to avoid unnecessarily comparing the first value with itself. The result is approximately 4x faster formin
andmax
, 5x faster formin-of
andmax-of
, and roughly unchanged forextreme
.master:
branch:
The stray comma before
not=
is necessary, oddly. With, it compiles to a singlejmpni
instruction. Without, it compiles toldn
,neq
,jmpno
.