# About reproducibility of Julia program run times

**URL:** <https://discourse.julialang.org/t/about-reproducibility-of-julia-program-run-times/127613>\
**Category:** Performance\
**Created:** [April 2, 2025, 12:37am UTC](https://discourse.julialang.org/t/about-reproducibility-of-julia-program-run-times/127613 "2025-04-02T00:37:12Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [April 2, 2025, 2:14am UTC](https://discourse.julialang.org/t/about-reproducibility-of-julia-program-run-times/127613/5 "2025-04-02T02:14:39Z")

</div>

The behavior you’re experiencing is Julia’s Just-Ahead-Of-Time compilation.

When you execute code that _defines_ a new function, no compilation happens. The first time that function is called _for a specific set of input types_ the Julia compiler kicks in and compiles the optimal machine code for that set of input types.

As of Julia v1.9, packages can define precompilation routines to trigger the compiler at package installation time which are then cached and can be used between sessions. However, user code is not cached between sessions, so each time you start a new Julia session, the compiler has to recompile all the methods for functions you define and methods for functions that are defined by packages but not hit during the precompilation routine.

This “slow” first execution issue is called “Time to first execution” (TTFX) or sometimes “time to first plot.” If you search the Discourse for these phrases, you will find LOTS of discussion.

There are two remedies.

1. PackageCompiler.jl as @karei mentioned. You will need to have some “dry run” code that will call all the methods you want precompiled. Warning – this produces a full Julia System image that is quite large.
2. This is not yet published, but in Julia v1.12, there will be a new ahead-of-time Julia compiler that will produce smaller executables.

---

_[View the full topic](https://discourse.julialang.org/t/about-reproducibility-of-julia-program-run-times/127613)._
