October 09, 2020
On Friday, 9 October 2020 at 15:44:27 UTC, Steven Schveighoffer wrote:
> A stride is not contiguous, it skips data.

Anyway, I think the main benefit of having stride support is that you can write an algorithm that requires say double or a pair of doubles (like a coordinate) and optimize it and compile it to one precompiled library and then use it on any sequence of structs. All you need to provide is the initial offset and the stride offset.

So, if you have some complicated algorithm with maybe some asm in it to do cluster analysis of coordinates, then you can use it on any uniform struct memory layout. It can even be completely different structs as long as they all have the same offset.

Assuming that the stride is a runtime parameter.

October 09, 2020
On 10/8/20 6:28 PM, James Blachly wrote:
> On 10/8/20 10:06 AM, Steven Schveighoffer wrote:
>> On 10/8/20 9:59 AM, Per Nordlöw wrote:
>>> On Thursday, 8 October 2020 at 13:43:01 UTC, Ola Fosheim Grøstad wrote:
>>>> Optimizations that require linear memory access, like SIMD. I believe.
>>>
>>> How could `isContiguousRange` be defined in D?
>>
>> isDynamicArray!T
>>
> 
> Is this trait true of slices pointing to user managed blocks? In particular I may use arena-allocation strategy but would love to have the type also be `isContiguousRange`

The memory a slice points at has nothing to do with its type. If it's a T[], it's a dynamic array.

-Steve
1 2 3 4 5
Next ›   Last »