# Where is the compiled code? Does julia compile the code on every run with \`julia somescript.jl\`

**URL:** <https://discourse.julialang.org/t/where-is-the-compiled-code-does-julia-compile-the-code-on-every-run-with-julia-somescript-jl/89340>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [October 27, 2022, 3:42am UTC](https://discourse.julialang.org/t/where-is-the-compiled-code-does-julia-compile-the-code-on-every-run-with-julia-somescript-jl/89340 "2022-10-27T03:42:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![benibilme](https://avatars.discourse-cdn.com/v4/letter/b/e5b9ba/32.png) [@benibilme](https://discourse.julialang.org/u/benibilme)\
**Post date:** [October 27, 2022, 3:42am UTC](https://discourse.julialang.org/t/where-is-the-compiled-code-does-julia-compile-the-code-on-every-run-with-julia-somescript-jl/89340/1 "2022-10-27T03:42:39Z")

</div>

Hello,

I am actually developer and pick up interest in julia and using it to refresh my algorithm and math skills.

I am hard core vim user and I accustomed to write scripts, programs and compile them. I generally do not use REPL or fancy jupiter environments, other than to debug or learn things.

I know that julia uses jit compiler. I would like to understand that if I run an unmodified julia script with `julia somescript.jl`, does julia always compile again or is there a cache mechanism which uses artifacts of previous compilation. If so where are those binaries or artifacts?

I run scripts so many times and I feel as if julia always recompiles even though there is no change in the file or in the code. It is so annoying. Is there anything, I need to know or better approach?

---

<div class="post-metadata">

**Author:** ![Tomas\_Pevny](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomas_pevny/32/25466_2.png) [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Post date:** [October 27, 2022, 4:44am UTC](https://discourse.julialang.org/t/where-is-the-compiled-code-does-julia-compile-the-code-on-every-run-with-julia-somescript-jl/89340/2 "2022-10-27T04:44:18Z")

</div>

As far as I know, scripts are always compiled again. There is some level of precompilation for modules, but binaries are not stored (yet). Of course, you can use package compiler to store compiled functions called in your module.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [October 27, 2022, 7:11am UTC](https://discourse.julialang.org/t/where-is-the-compiled-code-does-julia-compile-the-code-on-every-run-with-julia-somescript-jl/89340/3 "2022-10-27T07:11:03Z")

</div>

There is much active work on precompilation and static compilation, see e.g. [GitHub - JuliaLang/PackageCompiler.jl: Compile your Julia Package](https://github.com/JuliaLang/PackageCompiler.jl) and [GitHub - tshort/StaticCompiler.jl: Compiles Julia code to a standalone library (experimental)](https://github.com/tshort/StaticCompiler.jl) The latter aims to allow static compilation to small binaries, but currently has limited language support, afaik.

Currently, by default, Julia code is recompiled each time when run outside a REPL, so REPL-based workflows are the most popular.

---

<div class="post-metadata">

**Author:** ![jmair](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jmair/32/35117_2.png) [@jmair](https://discourse.julialang.org/u/jmair)\
**Post date:** [October 27, 2022, 7:45am UTC](https://discourse.julialang.org/t/where-is-the-compiled-code-does-julia-compile-the-code-on-every-run-with-julia-somescript-jl/89340/4 "2022-10-27T07:45:38Z")

</div>

Using a REPL and putting all your code into functions is the usual way to go. If you edit a function and rerun the file in the REPL it will update all the function definitions.

If you are used to Vim, you might want to try VS code (with the Julia extension) as you can enable Vim bindings to edit your code like you are used to. You will also have a built in REPL so you can send code directly from your active file to the REPL with `Ctrl+Enter`.

---

<div class="post-metadata">

**Author:** ![Raf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raf/32/3383_2.png) [@Raf](https://discourse.julialang.org/u/Raf)\
**Post date:** [October 27, 2022, 8:25am UTC](https://discourse.julialang.org/t/where-is-the-compiled-code-does-julia-compile-the-code-on-every-run-with-julia-somescript-jl/89340/5 "2022-10-27T08:25:15Z")

</div>

You can use Julia with vim with a terminal or tmux window for the repl. Zepl.vim is pretty good. Or vim-slime.

But do learn to use the REPL. If you run scripts like that you will hate Julia, youre working against the design.

---

<div class="post-metadata">

**Author:** ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Post date:** [October 27, 2022, 5:36pm UTC](https://discourse.julialang.org/t/where-is-the-compiled-code-does-julia-compile-the-code-on-every-run-with-julia-somescript-jl/89340/6 "2022-10-27T17:36:09Z")

</div>

> [@benibilme](#):
>
> I run scripts so many times and I feel as if julia always recompiles even though there is no change in the file or in the code. It is so annoying. Is there anything, I need to know or better approach?

Check out [DaemonMode.jl](https://github.com/dmolina/DaemonMode.jl). From the package’s README.md:

> Inspired by the daemon-mode of Emacs, this package uses a server/client model. This allows julia to run scripts a lot faster, because the package is maintained in memory between the runs of (to run the same script several times).

---

<div class="post-metadata">

**Author:** ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Post date:** [October 27, 2022, 6:16pm UTC](https://discourse.julialang.org/t/where-is-the-compiled-code-does-julia-compile-the-code-on-every-run-with-julia-somescript-jl/89340/7 "2022-10-27T18:16:37Z")

</div>

> [@benibilme](#):
>
> feel as if julia always recompiles even though there is no change in the file or in the code. It is so annoying. Is t

You could also experiment with some of the [Julia startup options](https://docs.julialang.org/en/v1/manual/command-line-options/#Command-line-switches-for-Julia) such as `compile=min` and/or `--optimize=0` and see if this speeds up the total time required for your particular scripts. If your scripts mainly use calls to built-in functions that are already pre-compiled into the default startup image, this could result in a speedup for you.
