Skip to content

Faster arrays of components #41

Closed
Closed
@jonniedie

Description

@jonniedie

Arrays of components in a ComponentArray unpack pretty slowly because they allocate. Something like this:

boid = ComponentArray(pos=zeros(2), vel=zeros(2))

boid_box = ComponentArray(pos=zeros(2), vel=zeros(2), θ=0, ω=0)

u0 = ComponentArray(boid_box=boid_box, boids=repeat([boid], 100))

Right now, doing u0.boids would allocate and be too expensive to use.

Maybe the right answer is StaticArrays. They wouldn't be able to be used for very large arrays of components, but it would at least it would make them useful for some problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions