chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] [PATCH] Some simplification rules for nested ##core#in


From: felix . winkelmann
Subject: [Chicken-hackers] [PATCH] Some simplification rules for nested ##core#inline forms
Date: Wed, 04 Sep 2019 11:59:31 +0200

The attached patch adds two optimization rules for certain uses of
##core#inline. It basically rewrites

(let ((<var> (##core#inline ...)))
  (<kont> ... <var> ...))

into

(<kont> ... (##core##inline ...) ...)

plus a variation on this. Removing the intermediate "let" form gives
more opportunities to merge conditionals into ##core#cond forms,
which in turn may reduce intermediate CPS lambdas.

While investigating a problem with coops, I noticed that the slot-
lookup cache was quite suboptimal, caused by the above mentioned
CPS lambdas in a procedure that ought to be very tight, using only
low-level operations. Applying this change improved the code
quite a bit. Note that in general, binding intermediate values to
"let"-bound variables is important for optimizations, but for
##core#inline forms this can be relaxed since these inline ops
are in most cases not further analyzed by the optimizer (with the
exception of lfa2, which doesn't use the target variable of a binding).

There are quite a few hits of this rewrite in the core system, but, alas,
the results seem to be negligible. Mario was so kind to run the
benchmark suite on this, but the differences seem to be more the
usual fluctuation than any substantial gain or loss.

Benchmarking slot-lookup in coops with this patch gives some minor
improvement, but not a lot.


felix

Attachment: 0001-Add-some-optimizer-simplification-rules.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]