Skip to content

Commit d17cb3f

Browse files
committed
bench: KalmanFilter no-allocation bench
1 parent 0ad3d58 commit d17cb3f

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

benchmark/benchmarks.jl

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ sys = [ tf(1.90,[1800.0,1]) tf(1.90,[1800.0,1]) tf(1.90,[1800.0,1]);
77

88
const SUITE = BenchmarkGroup()
99

10-
## ================== SimModel benchmarks =========================================
10+
## ==================================================================================
11+
## ================== SimModel benchmarks ===========================================
12+
## ==================================================================================
1113
linmodel = setop!(LinModel(sys, Ts, i_d=[3]), uop=[10, 50], yop=[50, 30], dop=[5])
1214
function f!(ẋ, x, u, d, p)
1315
mul!(ẋ, p.A, x)
@@ -47,7 +49,9 @@ SUITE["SimModel"]["allocation"]["NonLinModel_linearize!"] = @benchmarkable(
4749
samples=1
4850
)
4951

50-
## ================== StateEstimator benchmarks ================================
52+
## ==================================================================================
53+
## ================== StateEstimator benchmarks =====================================
54+
## ==================================================================================
5155
skf = SteadyKalmanFilter(linmodel)
5256

5357
SUITE["StateEstimator"]["allocation"] = BenchmarkGroup(["allocation"])
@@ -64,4 +68,21 @@ SUITE["StateEstimator"]["allocation"]["SteadyKalmanFilter_evaloutput"] = @benchm
6468
evaloutput($skf, $d),
6569
setup=preparestate!($skf, $y, $d),
6670
samples=1
71+
)
72+
73+
kf = KalmanFilter(linmodel, nint_u=[1, 1], direct=false)
74+
75+
SUITE["StateEstimator"]["allocation"]["KalmanFilter_preparestate!"] = @benchmarkable(
76+
preparestate!($kf, $y, $d),
77+
samples=1
78+
)
79+
SUITE["StateEstimator"]["allocation"]["KalmanFilter_updatestate!"] = @benchmarkable(
80+
updatestate!($kf, $u, $y, $d),
81+
setup=preparestate!($kf, $y, $d),
82+
samples=1
83+
)
84+
SUITE["StateEstimator"]["allocation"]["KalmanFilter_evaloutput"] = @benchmarkable(
85+
evaloutput($kf, $d),
86+
setup=preparestate!($kf, $y, $d),
87+
samples=1
6788
)

0 commit comments

Comments
 (0)