Skip to content

Iteration over continuous intervals of components #462

@Raikiri

Description

@Raikiri

Consider a simple bit of code that does multi-component iteration:

registry.view<position, velocity>().each([dt](auto &pos, auto &vel){
  pos += vel * dt;
});

Now I want to make it SIMD. It has to be done in chunks that are known to be continuous in memory. For example, this can be done via an API like this:

registry.view<position, velocity>().each([dt](auto *pos, auto *vel, size_t count){
  for(size_t offset = 0; offset < count; offset += 4)
  {
    MulAdd4(pos + offset, vel + offset, dt);
  }
  for(; offset < count; offset++)
  {
    pos[i] += vel[i] * dt;
  }
});

Is it possible to do something like this already? If no, how complicated would it be to implement?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions