Skip to content

Bad NEON performance #20

Description

@chriselrod
julia> using VectorizedRNG, Random

julia> x = Vector{Float64}(undef, 1024);

julia> @benchmark randn!(local_rng(), $x)
BenchmarkTools.Trial: 10000 samples with 9 evaluations.
 Range (min  max):  2.838 μs   4.028 μs  ┊ GC (min  max): 0.00%  0.00%
 Time  (median):     2.852 μs              ┊ GC (median):    0.00%
 Time  (mean ± σ):   2.862 μs ± 72.118 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%

    █▄                                                        
  ▃███▅▄▂▂▂▂▁▁▁▁▂▁▁▁▁▂▁▁▁▁▁▁▂▁▂▁▁▂▁▂▂▁▂▁▁▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▂▂▂ ▂
  2.84 μs        Histogram: frequency by time        3.16 μs <

 Memory estimate: 0 bytes, allocs estimate: 0.

julia> @benchmark randn!(Random.default_rng(), $x)
BenchmarkTools.Trial: 10000 samples with 10 evaluations.
 Range (min  max):  1.533 μs   6.983 μs  ┊ GC (min  max): 0.00%  0.00%
 Time  (median):     1.688 μs              ┊ GC (median):    0.00%
 Time  (mean ± σ):   1.693 μs ± 77.624 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%

                      ▂   ▇▂▂▂▇▅▂▂▁█▁▁ ▄                      
  ▂▁▁▁▂▂▂▂▂▂▂▂▃▃▃▃▆▄▅▅█▇████████████████▆▆▅▇▄▄▃▄▃▃▃▃▂▂▂▂▂▂▂▂ ▄
  1.53 μs        Histogram: frequency by time        1.83 μs <

 Memory estimate: 0 bytes, allocs estimate: 0.

julia> @benchmark rand!(local_rng(), $x)
BenchmarkTools.Trial: 10000 samples with 146 evaluations.
 Range (min  max):  698.918 ns    8.839 μs  ┊ GC (min  max): 0.00%  0.00%
 Time  (median):     700.630 ns               ┊ GC (median):    0.00%
 Time  (mean ± σ):   707.420 ns ± 120.934 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%

  ▄█▇▄                 ▄▄▁                                      ▂
  █████▇▆▆▆▄▅▄▆▅▆▆▆▆▅▅▅████▆▆▇█▅▆▆▄▆▆▆▆▇▆▅▄▁▁▄▅▅▄▅▄▄▅▆▅▅▄▃▆▅▅▄▅ █
  699 ns        Histogram: log(frequency) by time        755 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

julia> @benchmark rand!(Random.default_rng(), $x)
BenchmarkTools.Trial: 10000 samples with 152 evaluations.
 Range (min  max):  682.566 ns  949.836 ns  ┊ GC (min  max): 0.00%  0.00%
 Time  (median):     683.664 ns               ┊ GC (median):    0.00%
 Time  (mean ± σ):   687.544 ns ±  11.115 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%

  ██▅▃▁                ▃▄     ▁▁                                ▁
  ██████▇▇▇▇▇▆▅▆▆▅▆▄▅▄▄████▅▅▅███▇▆▅▆▆▆▆▆▅▅▃▄▄▄▄▄▅▂▄▅▃▅▂▄▅▄▄▄▅▅ █
  683 ns        Histogram: log(frequency) by time        735 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

julia> versioninfo()
Julia Version 1.9.0-DEV.1073
Commit 0b9eda116d* (2022-08-01 14:27 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.5.0)
  CPU: 8 × Apple M1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions