Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster arrays of components #41

Closed
jonniedie opened this issue Aug 6, 2020 · 1 comment
Closed

Faster arrays of components #41

jonniedie opened this issue Aug 6, 2020 · 1 comment

Comments

@jonniedie
Copy link
Owner

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.

@jonniedie
Copy link
Owner Author

StaticArrays didn't work so well. Ended up rolling my own LazyArray type for this based on Base.Generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant