org-arl / SignalAnalysis.jl

Signal analysis toolbox for Julia
MIT License
42 stars 11 forks source link

perf(array): reduce allocations using @views #27

Closed ymtoo closed 2 years ago

ymtoo commented 2 years ago

MWE:

c = 1500
θ = range(0.0, π; length=181)
sd = steering(0.0:1.0:5.0, c, θ)
s = signal(randn(9600,6), 9600)

Before:

@btime beamform(s, sd)
# 36.658 ms (4347 allocations: 172.44 MiB)

After:

@btime beamform(s, sd)
# 12.832 ms (3 allocations: 13.26 MiB)