Closed primo-ppcg closed 1 year ago
compare-reduce
compare
The result is approximately 75% faster for abstract types, and 130% as faster for numbers per invocation.
(use spork/test) (def a (range 10)) (timeit-loop [:repeat 1_000_000] "control " (< ;a)) (timeit-loop [:repeat 1_000_000] "splice " (compare< ;a)) (timeit-loop [:repeat 1_000_000] "number " (compare< 0 1)) (timeit-loop [:repeat 1_000_000] "s64 arg0" (compare< (int/s64 0) 1)) (timeit-loop [:repeat 1_000_000] "s64 arg1" (compare< 0 (int/s64 1)))
master:
control 0.213s, 0.2134µs/body splice 1.792s, 1.792µs/body number 0.296s, 0.2964µs/body s64 arg0 0.397s, 0.3967µs/body s64 arg1 0.402s, 0.4023µs/body
branch:
control 0.214s, 0.2142µs/body splice 0.408s, 0.4084µs/body number 0.128s, 0.1281µs/body s64 arg0 0.222s, 0.2224µs/body s64 arg1 0.234s, 0.2338µs/body
compare-reduce
a macro so that the comparators, which are known at compile time, compile to vm ops rather than function calls.compare
in thecompare-reduce
macro.The result is approximately 75% faster for abstract types, and 130% as faster for numbers per invocation.
master:
branch: