liquidsoap icon indicating copy to clipboard operation
liquidsoap copied to clipboard

Pre-compile to de Bruijn indices.

Open smimram opened this issue 2 years ago • 1 comments

Get rid of sources of inefficiencies during evaluation.

  • Use de Bruijn indices (integers) instead of variable names (which require string comparisons). In the current implementation this is somewhat counterbalanced by the fact that we restrict closures to the part which is really used (= free variables), but this operation is itself costly (we are filtering the whole environment).
  • We constantly compute positions for values whereas we should not need that anymore apart from specific cases (e.g. for reporting encoder errors), which can be handled specifically. Internal errors are not supposed to happen...
  • In many cases, we can pre-compute the order of application of arguments (especially since we dropped partial application), thus avoiding comparing labels.

smimram avatar Mar 03 '22 17:03 smimram

Before I forget: things are quite complicated by the presence of labeled and optional arguments... I am not really sure how to get rid of those.

smimram avatar May 17 '22 15:05 smimram