# \[BoundaryValueDiffEq.jl\] Avoid recompilation

**URL:** <https://discourse.julialang.org/t/boundaryvaluediffeq-jl-avoid-recompilation/113131>\
**Category:** General Usage\
**Tags:** diffeq, differentialequation\
**Created:** [April 18, 2024, 8:33am UTC](https://discourse.julialang.org/t/boundaryvaluediffeq-jl-avoid-recompilation/113131 "2024-04-18T08:33:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmxam](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@bmxam](https://discourse.julialang.org/u/bmxam)\
**Post date:** [April 18, 2024, 8:33am UTC](https://discourse.julialang.org/t/boundaryvaluediffeq-jl-avoid-recompilation/113131/1 "2024-04-18T08:33:13Z")

</div>

Hi,

I am trying to use the `TwoPointBVPProblem` from `BoundaryValueDiffEq`. I put my code in a file and runs it by including in the REPL. The code runs great but the first call to `solve` always triggers a (long) “recompilation” time. The next `solve` calls inside the files are ok. But if I keep the same REPL and include the file again, I always have this first precompilation time. Is there a way to avoid / improve it (apart from solution like `PackageCompiler`)?

Here is the full code and the timings on my machine. I am using `BoundaryValueDiffEq - 5.7.1`.

```julia
using BoundaryValueDiffEq

function f!(du, u, p, t)
    F0 = u[1]
    F1 = u[2]
    F2 = u[3]

    du .= F1, F2, 2 * F1 * (F2 / (F0 - p.myeps) - 1 / (p.r^2))
end

bc2a!(resid_a, u_a, p) = resid_a[1] = u_a[1]
bc2b!(resid_b, u_b, p) = resid_b .= u_b[1] + 1.0, u_b[2]

tspan = (-1.0, 0.0)
u0 = [-1.0, 0.0, 0.0] # I don't know how to use the init function

myeps = 1e-10
dt = 0.01
p = (r=1.0, myeps=myeps)
bvp = TwoPointBVProblem(f!, (bc2a!, bc2b!), u0, tspan, p; bcresid_prototype=(zeros(1), zeros(2)))
@time sol = solve(bvp, MIRK4(), dt=dt)
@time sol = solve(bvp, MIRK4(), dt=dt)

```

```julia
9.803415 seconds (2.23 M allocations: 153.588 MiB, 0.22% gc time, 99.98% compilation time: 100% of which was recompilation)
0.002087 seconds (13.48 k allocations: 1.517 MiB)

```

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [April 18, 2024, 12:25pm UTC](https://discourse.julialang.org/t/boundaryvaluediffeq-jl-avoid-recompilation/113131/2 "2024-04-18T12:25:19Z")

</div>

Open an issue, we’d have to dig into the compilation caches and see what’s missed.
