From 9773696aec67f8ed16d7e4cba62f02ea40b47cb3 Mon Sep 17 00:00:00 2001 From: Steve Kelly Date: Wed, 15 Mar 2023 14:37:17 -0400 Subject: [PATCH] capture precompilation statements with SnoopPrecompile This is a simple test of the native code-caching functionality in Julia 1.9. This should greatly improve runtime, at the expense of greater precompilation time and slightly greater package load time: With this PR, the runtime on Julia 1.9: ``` julia> @time using FUSE 21.957530 seconds (53.10 M allocations: 3.644 GiB, 8.49% gc time, 7.02% compilation time: 13% of which was recompilation) julia> @time FUSE.warmup() 43.951729 seconds (501.41 M allocations: 29.219 GiB, 8.02% gc time, 6.47% compilation time) ``` Whereas master: ``` julia> @time using FUSE 15.015840 seconds (42.16 M allocations: 2.971 GiB, 8.52% gc time, 10.46% compilation time: 13% of which was recompilation) julia> @time FUSE.warmup() 373.581675 seconds (796.96 M allocations: 46.873 GiB, 5.31% gc time, 87.77% compilation time: <1% of which was recompilation) ``` xref: https://github.com/ProjectTorreyPines/FUSE.jl/issues/252 xref: https://github.com/ProjectTorreyPines/FUSE.jl/issues/218 --- Project.toml | 1 + src/FUSE.jl | 6 ++++++ src/precompile.jl | 5 +++++ 3 files changed, 12 insertions(+) create mode 100644 src/precompile.jl diff --git a/Project.toml b/Project.toml index 7feb39bbd..8d3804a68 100644 --- a/Project.toml +++ b/Project.toml @@ -42,6 +42,7 @@ QED = "8bcbec86-48c7-11ec-16a6-c1bc83299373" QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SimulationParameters = "32ab26d3-25d6-405d-a295-367385e16093" +SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" TAUENN = "4f5ffc88-c87f-11eb-142e-4d2ba0394a67" TEQUILA = "a60c9cbd-e72f-4185-96b6-b8fc312c4d37" diff --git a/src/FUSE.jl b/src/FUSE.jl index 978ae6760..4bf5235bf 100644 --- a/src/FUSE.jl +++ b/src/FUSE.jl @@ -6,6 +6,7 @@ using IMAS import Plots using Plots using Printf +using SnoopPrecompile #= ===== =# # UTILS # @@ -116,6 +117,11 @@ include("logging.jl") #= ===== =# include("utils_end.jl") +#= ========== =# +# PRECOMPILE # +#= ========== =# +include("precompile.jl") + #= ====== =# #= EXPORT =# #= ====== =# diff --git a/src/precompile.jl b/src/precompile.jl new file mode 100644 index 000000000..a92ca371b --- /dev/null +++ b/src/precompile.jl @@ -0,0 +1,5 @@ +@precompile_setup begin + @precompile_all_calls begin + FUSE.warmup() + end +end \ No newline at end of file