You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following little function I'm using to experiment with
using AllocCheck
send_control(u) =sum(abs2, u) # Dummy control functioncalc_control() =1.0get_measurement() = [1.0]
functionexample_loop(data, t_start, y_start, y_old, ydf, Ts, N, r)
for i =1:N
t =time() - t_start
y =get_measurement()[] - y_start # Subtract initial position for a smoother experience
yd = (y - y_old) / Ts
ydf =0.9*ydf +0.1*yd
# r = 45sin(2π*freq*t)
u =calc_control()
send_control([u])
log = [t, y, ydf, u, r(t)]
data[:, i] .= log
y_old = y
endend## Generate some example input data
r = t->(2+2floor(t/4)^2)
N =10
data =Matrix{Float64}(undef, 5, N)
t_start =1.0
y_start =0.0
y_old =0.0
ydf =0.0
Ts =1.0
typetuple =typeof.((data, t_start, y_start, y_old, ydf, Ts, N, r))
AllocCheck.check_allocs(example_loop, typetuple, ignore_throw=true)
On Julia v1.10 beta3, I get several repeated AllocInstances for each actual allocation. With ignore_throw = true, I get 18 alloc instances, where at least 4 different sources of allocations are repeated 3 times each (12 instances for 4 real allocations)
Using BenchmarkTools, it appears as if the number of allocations actually happens in each loop iteration is 3 (N=10 loop iterations)
Hmm, it seems me workflow using Revise in the terminal was not working as I expected, please ignore this issue for now until I've figured out a better strategy. Sorry for the noise :/
I have the following little function I'm using to experiment with
On Julia v1.10 beta3, I get several repeated
AllocInstance
s for each actual allocation. Withignore_throw = true
, I get 18 alloc instances, where at least 4 different sources of allocations are repeated 3 times each (12 instances for 4 real allocations)Using BenchmarkTools, it appears as if the number of allocations actually happens in each loop iteration is 3 (
N=10
loop iterations)This matches with what I would expect,
get_measurement
,[u]
andlog = [t, y, ydf, u, r(t)]
The text was updated successfully, but these errors were encountered: