Adding parameters to function definition avoids allocations

I’ve now created a working MWE and posted it here.