SciML / SciML/ComponentArrays.jl
view vs getindex performance
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 375
- Forks
- 42
- Avg merge
- 7h 25m
- Merged PRs (30d)
- 17
Description
I was replacing AxisArrays with ComponentArrays in a package (MuJoCo.jl) since AxisArrays kills the initial compile time despite having excellent run-time performance. ComponentArrays has a compatible interface that doesn't break user's code, but there are performance differences when using getindex:

As you can see, doing the getindex style access of the ComponentArray is much slower than the view, although from the source code I can't exactly tell why that would be the case since they should both be converting to Vals (which seems to be the slowdown). For some reason the conversion toval doesn't happen at compile-time for getindex could explain the slow-down?
While I can access the data as a property q.slider that doesn't work for multi-dimensional ComponentArrays which we have. I'll put a note in our docs about this, but was wondering if you had any insights as to what's going on. Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin by comparing the ComponentArray getindex and view entry points and reproduce the access timings described in the issue. Done means explaining or correcting the conversion-to-Val performance difference, with updated behavior or guidance for multidimensional access.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100