# Very slow time to first plot, 2022

**URL:** <https://discourse.julialang.org/t/very-slow-time-to-first-plot-2022/88968>\
**Category:** General Usage\
**Tags:** ttfp\
**Created:** [October 19, 2022, 2:57pm UTC](https://discourse.julialang.org/t/very-slow-time-to-first-plot-2022/88968 "2022-10-19T14:57:07Z")\
**Posts on this page:** 1\
**Showing post:** 46

<div class="post-metadata">

**Author:** ![Krastanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/krastanov/32/6817_2.png) [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Post date:** [October 20, 2022, 3:57pm UTC](https://discourse.julialang.org/t/very-slow-time-to-first-plot-2022/88968/46 "2022-10-20T15:57:07Z")

</div>

Here are my attempts to work with this. On my computer I lowered TTFX from 90sec to 4sec.

> **version info**
>
> ```julia
> julia> versioninfo()
> Julia Version 1.9.0-DEV.1566
> Commit ea991745a99 (2022-10-10 13:10 UTC)
> Platform Info:
> OS: Linux (x86_64-linux-gnu)
> CPU: 16 × AMD Ryzen 7 1700 Eight-Core Processor
> WORD_SIZE: 64
> LIBM: libopenlibm
> LLVM: libLLVM-14.0.6 (ORCJIT, znver1)
> Threads: 1 on 16 virtual cores
> Environment:
> JULIA_EDITOR = code
> JULIA_NUM_THREADS = 1
> 
> ```

After precompiling and downloading datasets, I have the following:

```julia
julia> @time @eval include("plot.jl")
 85.086753 seconds (79.78 M allocations: 5.128 GiB, 3.66% gc time, 87.44% compilation time: 2% of which was recompilation)

```

gosh… This is ridiculously slow!

I used the sysimage builder from the VS code julia plugin. This was the `JuliaSysimage.toml` file I used:

```julia
[sysimage]
exclude=[] # Additional packages to be exlucded in the system image
statements_files=[] # Precompile statements files to be used, relative to the project folder
execution_files=["plot.jl"] # Precompile execution files to be used, relative to the project folder

```

I used your MWE as an execution file. Building the sysimage took 9 minutes.

With the sysimage I got:

```julia
julia> @time @eval include("plot.jl")
  3.846860 seconds (2.05 M allocations: 144.002 MiB, 1.33% gc time, 77.32% compilation time: 99% of which was recompilation)

```

The conclusion here is that I **had** to use an example workflow script in the generation of the sysimage, presumably because either CairoMakie or AlgebraOfGraphics is not using `SnoopPrecompile`. `SnoopPrecompile` is a tool that makes it easier for libraries to include example workflows which makes precompilation (and sysimages) more effective. I would suggest filing feature request issue to AlgebraOfGraphics. The ecosystem needs to use SnoopPrecompile more.

---

_[View the full topic](https://discourse.julialang.org/t/very-slow-time-to-first-plot-2022/88968)._
