# \[ANN\] PackageCompiler with incremental system images

**URL:** <https://discourse.julialang.org/t/ann-packagecompiler-with-incremental-system-images/20489>\
**Category:** Community\
**Tags:** compilation, precompilation\
**Created:** [February 5, 2019, 11:21pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-with-incremental-system-images/20489 "2019-02-05T23:21:16Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![timmm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/timmm/32/6760_2.png) [@timmm](https://discourse.julialang.org/u/timmm)\
**Post date:** [February 13, 2019, 3:18pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-with-incremental-system-images/20489/21 "2019-02-13T15:18:59Z")

</div>

Hi all,

I am sure this is very easy, but I am not sure I understand how to use this.

Using Julia 1.0.3, say I use:

```julia

]

add https://github.com/Timmmdavis/JuliaTravisTest

add PackageCompiler

build PackageCompiler

using PackageCompiler

PackageCompiler.compile_incremental("TravisTest",raw"C:\Users\username\.julia\packages\TravisTest\DirName\test\runtests.jl", force = false)

```

No errors 🙂 ;. I close and open Julia (as the compiler has snooped and complied the runtests.jl script).

```julia

using TravisTest

@time TravisTest.MrFunc(2)

0.006272 seconds (1.28 k allocations: 76.896 KiB)

@time TravisTest.MrFunc(2)

0.000007 seconds (4 allocations: 160 bytes)

```

Why do I still have the compile time on the first call? What have I misunderstood?

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [February 13, 2019, 3:43pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-with-incremental-system-images/20489/22 "2019-02-13T15:43:12Z")

</div>

It’s amazing, that this doesn’t error… will need to look into that.

Please use the instruction I posted:

> **[CairoMakie Environment](https://nextjournal.com/julia-environments/cairomakie-environment)**

You can then start julia with the new system image file:

```plaintext
new_image, old_image = PackageCompiler.compile_incremental(:YourPackage, force = false);
run(`julia -J$new_image`)

```

---

<div class="post-metadata">

**Author:** ![timmm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/timmm/32/6760_2.png) [@timmm](https://discourse.julialang.org/u/timmm)\
**Post date:** [February 13, 2019, 8:11pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-with-incremental-system-images/20489/23 "2019-02-13T20:11:33Z")

</div>

Mein gott! Amazing! Just to finish of my workflow above, might be useful for someone later on.

```julia
new_image,old_image=PackageCompiler.compile_incremental("TravisTest",raw"C:\Users\username\.julia\packages\TravisTest\DirName\test\runtests.jl", force = false)

```

write down new image link somewhere  
e.g.

```julia
new_image="C:\\Users\\username\\.julia\\packages\\PackageCompiler\\DirName\\sysimg\\sys.dll"     

```

then assuming you can open Julia inside Julia using (exe path being the path to julia)

```julia
exepath=raw"C:\Users\username\AppData\Local\Julia-1.0.3\bin\julia"
run(`$exepath`)

```

then opening a new julia window you define these two dirs (exeoath and new\_image) and call

```julia
run(`$exepath -J $new_image`)

```

which opens a new julia inside the one just opened  
then to finish my example above

```julia
using TravisTest
@time TravisTest.MrFunc(2)
0.000005 seconds (4 allocations: 160 bytes)

```

i.e. its precompiled! Note I am on Windows, apologies for the dodgy file paths and exe bits.

---

<div class="post-metadata">

**Author:** ![hhaensel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hhaensel/32/1207_2.png) [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Post date:** [February 21, 2019, 3:05pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-with-incremental-system-images/20489/24 "2019-02-21T15:05:46Z")

</div>

I tried to remove `IteratorInterfaceExtensions` from line 5 in `Tables.jl` and that way `Makie` compiles without error and I got rid of the warning. Also, `Tables.jl` is pre-compiling without error. It seems that someone has forgotten to remove the `using` statement after insertion of the `@require` statement.  
I will raise this issue in the `Tables.jl` package.

---

<div class="post-metadata">

**Author:** ![hhaensel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hhaensel/32/1207_2.png) [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Post date:** [February 22, 2019, 11:33am UTC](https://discourse.julialang.org/t/ann-packagecompiler-with-incremental-system-images/20489/25 "2019-02-22T11:33:15Z")

</div>

`Tables.jl` reacted promptly, it’s in the master already 🙂  
Thanks @quinnj!

[Previous page](https://discourse.julialang.org/t/ann-packagecompiler-with-incremental-system-images/20489.md?page=1)
