Skip to content

Change README rule of thumb #506

Open
@ChrisRackauckas

Description

@ChrisRackauckas

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 JuliaLang/julia#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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationdocumentation improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions