On 3/13/23 08:17, Salih Dincer wrote:

> In this case, using `ref` will increase performance while reducing the
> number of copies.

I am not sure about that. Unless there is an expensive copy construction, most objects are simple data copies.

To use 'ref' or not should be guided through semantics. Luckily, we have the -preview=in command line switch that removes the cost of copying from the equation:

  https://dlang.org/spec/function.html#in-params

Just marking the input parameters 'in' should be sufficient in most cases.

Ali

Reply via email to