By ref and by pointer kills performance.
jmh530
john.michael.hall at gmail.com
Tue Feb 13 15:43:40 UTC 2024
On Tuesday, 13 February 2024 at 15:40:23 UTC, jmh530 wrote:
> On Tuesday, 13 February 2024 at 06:02:47 UTC, Bruce Carneal
> wrote:
>> [...]
>
> As a heads up, the LDC wiki page doesn't have restrict on it.
>
> https://wiki.dlang.org/LDC-specific_language_changes
>
> Does LDC's @restrict only work with pointers directly and not
> slices? `fillRestricted2` doesn't compile (it only fails
> because `value` is a slice, not because `dest` is one. But
> `fillRestricted3` compiles just fine.
>
> ```d
> void fillRestricted2(@restrict uint[] value, uint[] dest)
> {
> dest[0] = value[0];
> dest[1] = value[1];
> dest[2] = value[2];
> dest[3] = value[3];
> }
>
> void fillRestricted3(@restrict uint* value, uint[] dest)
> {
> dest[0] = value[0];
> dest[1] = value[1];
> dest[2] = value[2];
> dest[3] = value[3];
> }
>
> ```
Sorry, I should note that while `fillRestricted3` compiles, It
has similar codegen as `fillBP`.
More information about the Digitalmars-d
mailing list