# Looking for advice on achieving faster startup times

**URL:** <https://discourse.julialang.org/t/looking-for-advice-on-achieving-faster-startup-times/61160>\
**Category:** Performance\
**Created:** [May 14, 2021, 2:07pm UTC](https://discourse.julialang.org/t/looking-for-advice-on-achieving-faster-startup-times/61160 "2021-05-14T14:07:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![enriquer](https://avatars.discourse-cdn.com/v4/letter/e/e9bcb4/32.png) [@enriquer](https://discourse.julialang.org/u/enriquer)\
**Post date:** [May 14, 2021, 2:46pm UTC](https://discourse.julialang.org/t/looking-for-advice-on-achieving-faster-startup-times/61160/2 "2021-05-14T14:46:24Z")

</div>

> [@Bring Julia code to embedded hardware (ARM)](https://discourse.julialang.org/t/bring-julia-code-to-embedded-hardware-arm/19979/64):
>
> To make sure: You compiled everything that is called in the script into the sysimage? That is, the remaining overhead is pure “Julia startup / initialisation”…? So the question would be whether (and if yes, how) this can be eliminated. An embedded system is usually expected (or even required) to start up quickly, so 10s is quite a lot of time (that would be added to the startup time of the system, incl. linux etc., itself).

I am letting `PackageCompiler.create_sysimage` handle the details of the compilation. I am giving it as `precompile_execution_file` the same script I am using for timing, so I was hoping that it would be precompiling anything that is significantly expensive, but that may not be not the case. I have just checked, and there are a few statements that, when using the sysimage, still take in the order of 1-2 seconds (each) to run the first time they appear in the script, but not on subsequent instances. For example, the first call to `print(Float64)` still takes over 2 seconds when using the sysimage. The second such call takes \<2ms.

I am not sure how much of that is due to precompilation, and how much due to non-cached vs. cached filesystem reads. Those times were measured after having run the script a few times, so I would expect that most of the filesystem reads are from cache, but I can’t be sure.

But at least half of the ~10 seconds that the script takes to run after rebooting the OS (i.e, with no filesystem caching) take place before any of the script statements start to be evaluated/precompiled. This initial overhead is similar to the time it takes Julia to “run” an empty script after a reboot (6 seconds).

---

_[View the full topic](https://discourse.julialang.org/t/looking-for-advice-on-achieving-faster-startup-times/61160)._
