[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] Rewrite vararg generic numeric procedures to d
[Chicken-hackers] [PATCH] Rewrite vararg generic numeric procedures to dyadic ones
Thu, 24 Aug 2017 22:15:18 +0200
Christian came up with a very nice benchmark that showed how chicken-5 is
quite a bit slower than master:
I've identified one problem and that's that this benchmark uses a call to
the * procedure with 3 arguments which results in a CPS call to C_times,
which in chicken-5 is much, much slower due to the missing unboxed flonum
loop and such. Now, we could try to optimise these vararg procedures too,
but I noticed a much better opportunity.
When we rewrite (* a b c) to (* (* a b) c), we get dyadic calls but not
only that, the scrutiny type information can be used to specialize those
calls (we only have specializations for dyadic calls). The generic
versions can't be optimized, even if we know for sure that all arguments
Attached is a patch that does this. I decided to get rid of the old
"19" class, because only one rewrite was using it and we probably want
to get rid of the fixnum mode some day.
A quick run of the benchmark suite points out that this is a small win
and gives a handful of benchmarks that are 20% faster, the other ones
are unaffected (modulo some noise).
Of course we could still put some effort in the generic operators, but
after this patch, the compiler should no longer generate calls to those
in the vast majority of cases. Only when "apply" is used or when * is
used as an unknown higher-order procedure it would be used.
Description: Text Data
Description: PGP signature
|[Prev in Thread]
||[Next in Thread]|
- [Chicken-hackers] [PATCH] Rewrite vararg generic numeric procedures to dyadic ones,
Peter Bex <=