# AutoSysimages.jl - Automate user-specific system images

**URL:** <https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359>\
**Category:** Package Announcements\
**Tags:** sysimage\
**Created:** [September 16, 2022, 10:49am UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359 "2022-09-16T10:49:50Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![petvana](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petvana/32/20881_2.png) [@petvana](https://discourse.julialang.org/u/petvana)\
**Post date:** [September 16, 2022, 10:49am UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/1 "2022-09-16T10:49:50Z")

</div>

I’d like to introduce new package [AutoSysimages.jl](https://github.com/petvana/AutoSysimages.jl) that aims to automate building process of sysimages. It records precompile statements during normal Julia usage. Then, building a user-specific system image for your project is possible by a single command.

Please find more details in the documentation, or in my recent post:  
[https://forem.julialang.org/petvana/introducing-autosysimagesjl-gsoc22-3pe8](https://forem.julialang.org/petvana/introducing-autosysimagesjl-gsoc22-3pe8)

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [September 16, 2022, 11:15am UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/2 "2022-09-16T11:15:05Z")

</div>

Tools like that are incredibly useful @petvana , thank you! :juliaheartpulsing:

---

<div class="post-metadata">

**Author:** ![jdad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jdad/32/4739_2.png) [@jdad](https://discourse.julialang.org/u/jdad)\
**Post date:** [September 16, 2022, 1:00pm UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/3 "2022-09-16T13:00:50Z")

</div>

Many thanks for the tool and the wonderful Forem article!

---

<div class="post-metadata">

**Author:** ![qwerty](https://avatars.discourse-cdn.com/v4/letter/q/4491bb/32.png) [@qwerty](https://discourse.julialang.org/u/qwerty)\
**Post date:** [September 16, 2022, 6:55pm UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/4 "2022-09-16T18:55:53Z")

</div>

Does your pkg speed up the startup of Pluto notebooks?

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [September 16, 2022, 7:07pm UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/5 "2022-09-16T19:07:43Z")

</div>

That is a nice idea, I wish we had some precompilation in Pluto, some button to press and precompile the workflow.

---

<div class="post-metadata">

**Author:** ![petvana](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petvana/32/20881_2.png) [@petvana](https://discourse.julialang.org/u/petvana)\
**Post date:** [September 16, 2022, 7:08pm UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/6 "2022-09-16T19:08:23Z")

</div>

Not yet, but we can try to integrate it into Pluto.

---

<div class="post-metadata">

**Author:** ![pablosanjose](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pablosanjose/32/7006_2.png) [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Post date:** [September 16, 2022, 7:13pm UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/7 "2022-09-16T19:13:54Z")

</div>

Oh nice!

Sounds similar to Fezzik.jl ([GitHub - TsurHerman/Fezzik: Brute force sysimg building for Julia](https://github.com/TsurHerman/Fezzik))

---

<div class="post-metadata">

**Author:** ![petvana](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petvana/32/20881_2.png) [@petvana](https://discourse.julialang.org/u/petvana)\
**Post date:** [September 16, 2022, 7:42pm UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/8 "2022-09-16T19:42:55Z")

</div>

I’ve just tried the Pluto, and it seems to be able to reduce the loading just out-of-the-box.

[![asciicast](https://asciinema.org/a/mx6vleUUZSryFRnXdnthkHdZ2.svg)](https://asciinema.org/a/mx6vleUUZSryFRnXdnthkHdZ2)

(Notice, the compilation takes only 60s because I use the very experimental chained build.)

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [September 16, 2022, 10:25pm UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/9 "2022-09-16T22:25:39Z")

</div>

Hi, I gave a try on it but apparently `select_packages()` is unable to find packages in _dev_ mode.

---

<div class="post-metadata">

**Author:** ![petvana](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petvana/32/20881_2.png) [@petvana](https://discourse.julialang.org/u/petvana)\
**Post date:** [September 17, 2022, 12:28am UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/10 "2022-09-17T00:28:07Z")

</div>

This is intentional that `dev` packages are not allowed to be included because such packages are not static and you would need to rebuild the sysimage after any change. Thus, it seems reasonable to include only released packages.

---

<div class="post-metadata">

**Author:** ![ktdq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ktdq/32/37377_2.png) [@ktdq](https://discourse.julialang.org/u/ktdq)\
**Post date:** [September 17, 2022, 1:46am UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/11 "2022-09-17T01:46:28Z")

</div>

It is possible to revise packages that are compiled into sysimage with [Track packages compiled into sysimage by ktdq · Pull Request #688 · timholy/Revise.jl · GitHub](https://github.com/timholy/Revise.jl/pull/688)

I’m running with `dev` packages compiled in and startup latencies are gone.

---

<div class="post-metadata">

**Author:** ![StatisticalMouse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/statisticalmouse/32/43370_2.png) [@StatisticalMouse](https://discourse.julialang.org/u/StatisticalMouse)\
**Post date:** [September 17, 2022, 7:08am UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/12 "2022-09-17T07:08:15Z")

</div>

I’d like to get a version that we would call ’juliacompile’ with no questions asked. Then running a script could look like this:

> juliacompile benchmark.jl  
> julia benchmark.jl

---

<div class="post-metadata">

**Author:** ![petvana](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petvana/32/20881_2.png) [@petvana](https://discourse.julialang.org/u/petvana)\
**Post date:** [September 17, 2022, 7:21am UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/13 "2022-09-17T07:21:24Z")

</div>

No questions should be asked for non-REPL (noninteractive) usage. Thus the following should work (once you create the sysimage). Or you can rename the startup script…

```julia
asysimg benchmark.jl
julia benchmark.jl

```

The only difference for now is that it prints the `@info`. We can suppress it in non-REPL mode in the future.

---

<div class="post-metadata">

**Author:** ![StatisticalMouse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/statisticalmouse/32/43370_2.png) [@StatisticalMouse](https://discourse.julialang.org/u/StatisticalMouse)\
**Post date:** [September 17, 2022, 7:40am UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/14 "2022-09-17T07:40:58Z")

</div>

> **[Which programming language is fastest? (Benchmarks Game)](https://benchmarksgame-team.pages.debian.net/benchmarksgame/index.html)**
>
> Performance measurements and comparisons of computer programs for different programming language implementations.

Let’s call it the compile step for this.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [September 17, 2022, 9:13am UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/15 "2022-09-17T09:13:56Z")

</div>

Do I have to add AutoSysimages to my local project, or is it sufficient if I add it to the global environment?

---

<div class="post-metadata">

**Author:** ![petvana](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petvana/32/20881_2.png) [@petvana](https://discourse.julialang.org/u/petvana)\
**Post date:** [September 17, 2022, 9:32am UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/16 "2022-09-17T09:32:40Z")

</div>

It should be sufficient to add AutoSysimages into the global environment. Also, AutoSysimages is automatically included to the sysimage for faster startup, unless AutoSysimages is in dev mode.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [September 17, 2022, 10:10am UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/17 "2022-09-17T10:10:54Z")

</div>

To be honest, I do not see ANY effect from using AutoSysimages.

What I did (on Ubuntu):

1. install AutoSysimages
2. change folder of my work project
3. run asysimg --project
4. run include(“src/plot.jl”) from the asysimage prompt
5. close the plot window
6. press \<ctrl\>+\<d\>
7. I get the message:

```julia
asysimg> 
[ Info: AutoSysimages: Copy snooped statements to: /home/ufechner/.julia/asysimg/1.8.1/23RTv7/snoop-file.jl
[ Info: There is no sysimage for this project. Do you want to build one?
 > Yes
   No

```

I press enter and select No for the next question (do you want to select packages).

Now it builds a system image.

```julia
[ Info: AutoSysimages: Copy snooped statements to: /home/ufechner/.julia/asysimg/1.8.1/23ZRuw/snoop-file.jl
[ Info: There is no sysimage for this project. Do you want to build one?
 > Yes
   No
[ Info: AutoSysimages: Collecting precompile statements for empty run (-e "")
[ Info: AutoSysimages: Building system image by PackageCompiler.
⠇ [00m:10s] PackageCompiler: compiling incremental system image┌ Warning: There is no statement file
└ @ Main.anonymous /home/ufechner/.julia/packages/AutoSysimages/LTaGS/src/precompile-PackageCompiler.jl:44

✔ [02m:25s] PackageCompiler: compiling incremental system image
[ Info: AutoSysimages: Builded in 147.87036108970642 s

```

If I now launch julia again and run the same include statement the time to first plot is 17s as before:

```julia
ufechner@TUD277255:~/repos/Plotting$ asysimg --project
┌ Info: The package AutoSysimages.jl started!
│ Loaded sysimage: Default (You may run AutoSysimages.build_sysimage())
│ Active directory: /home/ufechner/.julia/asysimg/1.8.1/23ZRuw
│ Global snoop file: /home/ufechner/.julia/asysimg/1.8.1/23ZRuw/snoop-file.jl
└ Tmp. snoop file: /tmp/jl_gJmh8ds5yB-snoop.jl
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.8.1 (2022-09-06)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

asysimg> @time include("src/plot.jl")
To zoom, draw a rectangle while keeping the right mouse key pressed!
To go back to see the full graph, press <CRTRL><f>
 17.618484 seconds (43.41 M allocations: 2.397 GiB, 4.78% gc time, 71.93% compilation time: 12% of which was recompilation)

```

You can find and clone the example project I used here: [GitHub - ufechner7/Plotting](https://github.com/ufechner7/Plotting)

My impression is that it creates a sysimage, but it does not use it later.

Any idea?

---

<div class="post-metadata">

**Author:** ![petvana](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petvana/32/20881_2.png) [@petvana](https://discourse.julialang.org/u/petvana)\
**Post date:** [September 17, 2022, 12:10pm UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/18 "2022-09-17T12:10:29Z")

</div>

> [@ufechner7](#):
>
> To be honest, I do not see ANY effect from using AutoSysimages.  
> …

It determines the active directory `/home/ufechner/.julia/asysimg/1.8.1/23ZRuw` correctly, but the sysimage is not loaded (see, `Loaded sysimage: Default`). I’ll look at it, and moved the discussion to [Unable to save/load sysimage · Issue #5 · petvana/AutoSysimages.jl · GitHub](https://github.com/petvana/AutoSysimages.jl/issues/5). Thank you for the detailed report.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [September 17, 2022, 12:25pm UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/19 "2022-09-17T12:25:08Z")

</div>

> [@petvana](#):
>
> This is intentional that `dev` packages are not allowed to be included because such packages are not static and you would need to rebuild the sysimage after any change.

But that means a developer cannot test to compile its own package. And all developers have more than one Julia version installed, so he/she could develop in one version and try/use it in another.

---

<div class="post-metadata">

**Author:** ![petvana](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petvana/32/20881_2.png) [@petvana](https://discourse.julialang.org/u/petvana)\
**Post date:** [September 17, 2022, 12:45pm UTC](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359/20 "2022-09-17T12:45:46Z")

</div>

> [@joa-quim](#):
>
> But that means a developer cannot test to compile its own package. And all developers have more than one Julia version installed, so he/she could develop in one version and try/use it in another.

You can explicitly add them into the `include` list as in the documentation:  
“Notice `dev` packages are excluded unless they are in `include` list.”

Moreover, you can include all the dependencies which should reduce the loading time in most of the cases.

[Next page](https://discourse.julialang.org/t/autosysimages-jl-automate-user-specific-system-images/87359.md?page=2)
