Type Instability when composing functor and function

Thanks! I confirmed that making mdl constant in my initial example following your suggestion resolve the issue there too.

Since I always end up declaring stuff in global scope when debugging/trying things out, I guess the lesson is to declare stuff constant when checking for type instability. I suppose BenchmarkTools already does this when one interpolates variables using $, so if one sees excessive allocations when benchmarking, this kind of type instability isn’t to blame.