JuliaLang/julia

Consider improving performance of rand! for view of BitArray

Open

#41.862 aperta il 11 ago 2021

Vedi su GitHub
 (1 commento) (4 reazioni) (0 assegnatari)Julia (5773 fork)batch import
help wantedperformance

Metriche repository

Star
 (48.709 star)
Metriche merge PR
 (Merge medio 20g 6h) (157 PR mergiate in 30 g)

Descrizione

Currently the fast path for rand! is used only for BitArray but not for views of BitArray:

julia> x = falses(10^8);

julia> y = @view x[:];

julia> @time rand!(x);
  0.002921 seconds

julia> @time rand!(y);
  0.206912 seconds (1 allocation: 48 bytes)

I propose to add support for views also (it requires careful handling of view boundaries along the fastest changing dimension, but for large vectors this should be negligible overhead).

Guida contributor