JuliaArrays / JuliaArrays/StaticArrays.jl

Change README rule of thumb

Open
#506 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
Julia
Stars
844
Forks
159
Avg merge
3d 21h
Merged PRs (30d)
3

Description

The README says:

Note that in the current implementation, working with large StaticArrays puts a lot of stress on the compiler, and becomes slower than Base.Array as the size increases. A very rough rule of thumb is that you should consider using a normal Array for arrays larger than 100 elements. For example, the performance crossover point for a matrix multiply microbenchmark seems to be about 11x11 in julia 0.5 with default optimizations.

In Julia v1.0 there were some pretty big changes to tuple optimizations, for example https://github.com/JuliaLang/julia/pull/27398 . Since SVectors are backed by tuples, this seemed to have a pretty big effect on large static arrays. For example, 11x11 used to be over the tuple inference limit, counter acted by some of the nice generated functions in StaticArrays.jl, and that made them seem to match. But without that inference limit, 11x11 seems to be much better than before.

@dpsanders mentioned in Slack

Chris Rackauckas [6:43 PM]

>For example, the performance crossover point for a matrix multiply microbenchmark seems to be about 11x11 in julia 0.5 with default optimizations.

Is probably much higher now.

David Sanders [6:47 PM]
Yes, my global optimization code in N dimensions now is super fast
(N-dimensional `IntervalBox`es just wrap an `SVector` of `Interval`s)
Something like a factor of 10 faster than with Julia 0.6

I think it might be worth re-evaluating the rule of thumb for the README since now the definition of "small" may have shifted. In another sense, "small" seems to have shifted high enough that now it's a discussion of runtime vs compilation time (compilation time can grow pretty fast for much larger static arrays, once again quoting @dpsanders

If I use SVectors of big dimension (e.g. 100, 200) there seems to be a huge compile-time penalty, but the calculations themselves are blindingly fast. Is this normal?

). So a more nuanced discussion is probably needed in Julia v1.0 land, and I think this is important since that 11x11 number is something I and others copy around as a nice heuristic which may now be old!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the rule-of-thumb passage in the README and review the Julia 1.0 performance and compilation-time concerns described in the issue. Re-evaluate the 100-element and 11x11 guidance, then update the README with evidence-based, appropriately nuanced advice when the old heuristic is no longer representative.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.