[Blog post] Why and when you should use SoA

ZombineDev via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Mar 25 14:41:13 PDT 2016


On Friday, 25 March 2016 at 21:22:51 UTC, ZombineDev wrote:
> On Friday, 25 March 2016 at 01:07:16 UTC, maik klein wrote:
>> Link to the blog post: https://maikklein.github.io/post/soa-d/
>> Link to the reddit discussion: 
>> https://www.reddit.com/r/programming/comments/4buivf/why_and_when_you_should_use_soa/
>
> Nice article. BTW, I would abstract the container concept from 
> the SOA implementation, in order to allow for pluggable 
> containers which probably simplify the code a little bit.

Another note - you can further simplify the implementation by 
using Fields!T and .tupleof. For example:

void insertBack(Fields!T fields)
// ....

void insertBack(T t)
{
     if(length == size) grow;

     foreach(idx, field; t.tupleof)
         containers[idx][length] = field;

     length++;
}


More information about the Digitalmars-d-announce mailing list