Hi folks -

I was wondering what we can do to increase simulation speed. Its taking ridecolus amount of time to simulate 1000 subjects.

```
Sub = map(i-> Subject(;id=i, events=event, covariates=(dose=dose, wt=70, sex=1,)), 1:1000)
__sim = simobs(model, Sub, final_estimates,
simulate_error=false, obstimes=0:0.01:288)
```

This is the code.

```
model = @model begin
@param begin
θ ∈ VectorDomain(7, lower=zeros(7))
Ω ∈ PDiagDomain(5)
σ ∈ RealDomain(;lower=0.001)
end
@random begin
η ~ MvNormal(Ω)
end
@covariates dose wt
@pre begin
CLi = exp(log(θ[1]) + 0.75 * log(wt/70) + η[1])
Vi = exp(log(θ[2]) + log(wt/70) + η[2])
kai = exp(log(θ[3]) + η[3])
Qi = exp(log(θ[6])+ 0.75 * log(wt/70))
Vpi = exp(log(θ[7]) + log(wt/70) + η[5])
end
@dosecontrol begin
f50i = exp(log(θ[4]) + η[4])
fmax = exp(log(θ[5]))
bio = dose < 50 ? 1 : 1 - fmax * (dose - 50)/ (f50i + (dose - 50) )
bioav = (y1=bio, y2=1, y3 = 1,)
end
@dynamics begin
y1' = -kai * y1
y2' = kai * y1 - (CLi/Vi) * y2 + (Qi/Vpi) * y3 - (Qi/Vi) * y2
y3' = - (Qi/Vpi) * y3 + (Qi/Vi) * y2
y4' = y2/Vi
end
@derived begin
auc = @. 1_000 * y4
cp := @. 1_000 * y2 / Vi
dv ~ @. Normal(cp, cp * σ)
end
end
```

The final estimates:

```
(θ = [0.04389707139276508, 7.642248641569024, 0.5063665507090237, 55.583019021299606, 0.7764954718388033, 0.7811025178500393, 6.995697749715079],
Ω = Diagonal(ones(5) * 0.15),
σ = 0.01)
```

If I did few subjects, It’s fast, the estimation, is fast, but when simulating this much, it takes more than 30 minutes. Any ideas? I think the issue is coming from `DataFrame`