Time to first plot with system image not as good as expected

I am trying to reduce the time-to-first-plot by using a system image. What I am doing is explained in detail here: GitHub - ufechner7/Plotting: Demo for using InspectDR

If you are using Linux you can easily reproduce my results.

Without system image:

ufechner@TUD277255:~/repos/Plotting$ julia --project
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.1 (2022-09-06)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> @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 <CTRL><f>
 15.647398 seconds (38.22 M allocations: 2.047 GiB, 4.96% gc time, 79.17% compilation time: 12% of which was recompilation)

With system image:

ufechner@TUD277255:~/repos/Plotting$ asysimg --project
┌ Info: The package AutoSysimages.jl started!
│  Loaded sysimage:    /home/ufechner/.julia/asysimg/1.8.1/23ZRuw/asysimg-2022-09-18T12-39-40.634.so
│  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_1yJIleFuBE-snoop.jl
┌ Warning: Function 'pkgversion' is needed to check versions.
└ @ AutoSysimages ~/.julia/packages/AutoSysimages/LTaGS/src/AutoSysimages.jl:375
               _
   _       _ _(_)_     |  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 <CTRL><f>
  7.374812 seconds (20.07 M allocations: 1.012 GiB, 7.48% gc time, 99.52% compilation time)

Why do I have still 99.5% compilation time even though I am using a system image?

Could it be that the fact that I am using Gtk.shortNames, but Gtk is in the Project.toml file confuses AutoSysimages or PackageCompiler?

using Gtk.ShortNames, InspectDR

function init()
    inspectdr()
    InspectDR.defaults.xaxiscontrol_visible = false
    default(width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12)
end

function plot(params...; keywords...)
    p = Plots.plot(params...; keywords...)
    pIDR = display(p)            # Display with InspectDR and keep plot object
    resize!(pIDR.wnd, 1200, 700) # Resize GTK window directly
    G_.keep_above(pIDR.wnd, true)
end

How much snoopprecompilation is setup in InspectDR?

But why should that matter? AutoSysimage is recording the commands I executed on the command line…

Does it have the special handling of dynamic dispatching code that SnoopPrecompile.jl has? Generally calls after a dynamic dispatch are dropped from things which build precompile files, and SnoopPrecompile.jl specifically fixes that and I’ve seen that cause dramatic differences. I am curious whether AutoSysimage took the care to handle that (or how it’s building its trace)