Performance implications of template-level let bindings

First, a bit of context on the warning: This is coming from -Wunused-binds which is not enabled by default. We are planning to fix the false positive here at some point but didn’t have the time so far. I recommend looking at Making the most out of DAML Compiler warnings for a list of warnings that are useful and don’t cause false positives.

As for performance implications of inlining this, there is no difference here. Template-level let’s are desugared to a let in each choice, signature expression, …. You might be wondering why we don’t just compute it once instead. The reason for this is that there is no place where we could store the result once a contract is created. If a choice is being executed you only have access to the template and the choice argument but we don’t want want to modify either of those.
Of course, if you use it multiple times within the same choice, you probably want to compute it once at the beginning of the choice which is what the template-level let binding will do.