From faceeefeae7fc7067b3fdc934a5d928a0746aa32 Mon Sep 17 00:00:00 2001 From: Tortar Date: Sun, 27 Oct 2024 20:43:33 +0100 Subject: [PATCH 1/2] Improve TTFX --- Project.toml | 2 ++ src/BeforeIT.jl | 3 +++ src/precompile.jl | 14 ++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 src/precompile.jl diff --git a/Project.toml b/Project.toml index ae4506c..3698b55 100644 --- a/Project.toml +++ b/Project.toml @@ -12,6 +12,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MAT = "23992714-dd62-5051-b70f-ba57cb901cac" MutableNamedTuples = "af6c499f-54b4-48cc-bbd2-094bba7533c7" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" +PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd" @@ -25,6 +26,7 @@ LinearAlgebra = "1" MAT = "0.10" MutableNamedTuples = "0.1.3" Plots = "1" +PrecompileTools = "1" Random = "1" StatsBase = "0.34" StatsPlots = "0.15" diff --git a/src/BeforeIT.jl b/src/BeforeIT.jl index b973393..51a0998 100644 --- a/src/BeforeIT.jl +++ b/src/BeforeIT.jl @@ -59,4 +59,7 @@ include("utils/standard_calibration_data.jl") # shocks include("shocks/shocks.jl") + +include("precompile.jl") + end diff --git a/src/precompile.jl b/src/precompile.jl new file mode 100644 index 0000000..f8ec69c --- /dev/null +++ b/src/precompile.jl @@ -0,0 +1,14 @@ + +using PrecompileTools + +@setup_workload let + parameters = BeforeIT.AUSTRIA2010Q1.parameters + initial_conditions = BeforeIT.AUSTRIA2010Q1.initial_conditions + T = 1 + @compile_workload let + model = BeforeIT.init_model(parameters, initial_conditions, T) + data = BeforeIT.init_data(model); + BeforeIT.one_epoch!(model) + BeforeIT.update_data!(data, model) + end +end \ No newline at end of file From c636835707cb279e14d162f82cb12b19d392cbee Mon Sep 17 00:00:00 2001 From: Adriano Meligrana <68152031+Tortar@users.noreply.github.com> Date: Sun, 27 Oct 2024 20:47:43 +0100 Subject: [PATCH 2/2] formatting --- src/precompile.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/precompile.jl b/src/precompile.jl index f8ec69c..1e7361e 100644 --- a/src/precompile.jl +++ b/src/precompile.jl @@ -3,12 +3,12 @@ using PrecompileTools @setup_workload let parameters = BeforeIT.AUSTRIA2010Q1.parameters - initial_conditions = BeforeIT.AUSTRIA2010Q1.initial_conditions - T = 1 + initial_conditions = BeforeIT.AUSTRIA2010Q1.initial_conditions + T = 1 @compile_workload let model = BeforeIT.init_model(parameters, initial_conditions, T) - data = BeforeIT.init_data(model); - BeforeIT.one_epoch!(model) - BeforeIT.update_data!(data, model) + data = BeforeIT.init_data(model); + BeforeIT.one_epoch!(model) + BeforeIT.update_data!(data, model) end -end \ No newline at end of file +end