SciML / SciML/ComponentArrays.jl
Slow construction
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 375
- Forks
- 42
- Avg merge
- 7h 25m
- Merged PRs (30d)
- 17
Description
-
Construction of this ComponentArray is very slow
n=3000; a=rand(n,n);b=rand(n)
@btime C=ComponentArray(a=a,b=b);
This takes more than 9 seconds even after the timing stablizes. Meanwhile, the following will be very fast
@time C=ComponentArray(b=b); C=ComponentArray(C,b=b,a=a) #--> 0.002 seconds
If you switch the above around it will be slow
@time C=ComponentArray(a=a); C=ComponentArray(C,a=a,b=b) #--> 11 seconds -
It will also be nice to have a constructor in this format
n = 3000;
symbol_list = [:a, :b, :c]; size_list = [(n,n),(n,),(n,n)]
C=ComponentArray(data, symbol_list, size_list); # Data may be pre-allocated, or it could be omitted, in which case the code calculates how much total is needed from size_list.
Or it could be like this:
ax=ConstructAxis(symbol_list, size_list);
C=ComponentArray(data, ax)
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
Start by reproducing the two ComponentArray construction timings in the issue with n=3000, then trace the constructor path used for multiple named components. Compare the fast incremental construction with the slow combined construction; done means the reported slowdown is addressed and the requested constructor form is clarified or implemented.
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
- Mostly clear
- Newbie friendliness
- 35/100