Thread overview
Structure of Arrays vs Array of Structures
Aug 26, 2019
Per Nordlöw
Aug 26, 2019
Per Nordlöw
Aug 26, 2019
a11e99z
August 26, 2019
https://forum.dlang.org/post/cvsajblducyanpqahrwe@forum.dlang.org

On Monday, 15 May 2017 at 06:44:53 UTC, Nordlöw wrote:
> After having watched Jonathan Blow's talk on Jai
>
> https://www.youtube.com/watch?v=TH9VCN6UkyQ&t=2880s
>
> I realized that we should add his Array-of-Structures (AoS) concept to Phobos, preferrably in std.typecons.StructArrays, as something like
>
> template StructArrays(Members...)

I have made some significant optimizations with regards to compilation performance at

https://github.com/nordlow/phobos-next/blob/master/src/soa.d
August 26, 2019
On Monday, 26 August 2019 at 09:54:30 UTC, Per Nordlöw wrote:
> I have made some significant optimizations with regards to compilation performance at
>
> https://github.com/nordlow/phobos-next/blob/master/src/soa.d

What is the preferred way to implement to support foreach over `x` in

    struct S { int i; float f; }
    auto x = SOA!S();
    foreach (S; x[])
    {
    }

?

Implement `opSlice` that returns a SOA.Range type?
August 26, 2019
On Monday, 26 August 2019 at 09:58:30 UTC, Per Nordlöw wrote:
> On Monday, 26 August 2019 at 09:54:30 UTC, Per Nordlöw wrote:
>> I have made some significant optimizations with regards to compilation performance at
>>
>> https://github.com/nordlow/phobos-next/blob/master/src/soa.d
>
> What is the preferred way to implement to support foreach over `x` in
>
>     struct S { int i; float f; }
>     auto x = SOA!S();
>     foreach (S; x[])
>     {
>     }
>
> ?
>
> Implement `opSlice` that returns a SOA.Range type?

1) not sure about opSlice cuz user can allocate every time when he need S[..] from SOA.
  easy call for user but its too expensive op.
  maybe better to define global array( T )( SOA!T {opt: int beg, int end}) that returns array.
> x.array or array( x ) or x.array( 10, 20)
  looks like DRT that means "some range to newly allocated array". and SOA to S is some calculated range - need construct each element.

2) x.items returns SOA.Range