From 41ba51185d5d25881ca00bc67002328282f92984 Mon Sep 17 00:00:00 2001 From: Marco Matthies <71844+marcom@users.noreply.github.com> Date: Wed, 22 May 2024 19:36:00 +0200 Subject: [PATCH] Add scripts for creating a system image to speed up GUI loading Running PersefoneDesktop with this custom system image, latencies are reduced as follows: - startup time of the GUI (until the map is shown): 50s (previously 95s) - showing the population graph window: <1s (previously multiple seconds) The system image is created with `sysimg_create.jl`. To use the system image, run `julia -J sysimg.so desktop.jl`. The majority of the remaining startup time (45s of 50s) is due to the initialisation of the Persefone simulation. This might be reduced by further improving persefone-model. --- .gitignore | 2 ++ sysimg_create.jl | 15 +++++++++++++++ sysimg_precompile.jl | 6 ++++++ 3 files changed, 23 insertions(+) create mode 100755 sysimg_create.jl create mode 100644 sysimg_precompile.jl diff --git a/.gitignore b/.gitignore index 392be0f..1d93ec1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ examples # environment. Manifest.toml +# system image used to speed up GUI loading +/sysimg.so \ No newline at end of file diff --git a/sysimg_create.jl b/sysimg_create.jl new file mode 100755 index 0000000..e0abc14 --- /dev/null +++ b/sysimg_create.jl @@ -0,0 +1,15 @@ +#!/usr/bin/env julia + +import Pkg +Pkg.activate(".") + +using PackageCompiler + +# Creating the sysimg takes a few minutes and uses around 13GB of RAM. +# +# TODO: currently all GUI functions must be called manually, optimally +# every GUI function is called and a complete simulation is run. +create_sysimage(["Persefone", "CSV", "CxxWrap", "DataFramesMeta", "FileIO", "GLMakie", + "GeometryBasics", "Observables", "QML", "ResumableFunctions", "TableTransforms", "TOML"], + sysimage_path="sysimg.so", + precompile_execution_file="sysimg_precompile.jl") diff --git a/sysimg_precompile.jl b/sysimg_precompile.jl new file mode 100644 index 0000000..5d64ff2 --- /dev/null +++ b/sysimg_precompile.jl @@ -0,0 +1,6 @@ +using PersefoneDesktop +# TODO: currently all important GUI functions that should be +# precompiled must be called manually, and then the GUI must be closed +# manually. It would be good if this could be completely automated. +launch() + -- GitLab