From 3a5393cce7fc653a9bcdd24f134cc9100b58b527 Mon Sep 17 00:00:00 2001 From: mgiordano Date: Fri, 18 Oct 2024 05:40:13 -0500 Subject: [PATCH 1/2] Do not call `rand` during sysimage precompilation --- contrib/generate_precompile.jl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/contrib/generate_precompile.jl b/contrib/generate_precompile.jl index 04d13011d6223..58c8fb2fe8998 100644 --- a/contrib/generate_precompile.jl +++ b/contrib/generate_precompile.jl @@ -183,10 +183,11 @@ for match = Base._methods(+, (Int, Int), -1, Base.get_world_counter()) # interactive startup uses this write(IOBuffer(), "") - # not critical, but helps hide unrelated compilation from @time when using --trace-compile - foo() = rand(2,2) * rand(2,2) - @time foo() - @time foo() + # Not critical, but helps hide unrelated compilation from @time when using --trace-compile. + # Do not call `rand` which can cause bad caching on some platforms: #56177. + f55729() = ones(2, 2) * ones(2, 2) + @time f55729() + @time f55729() break # only actually need to do this once end From fcd1f96819ade1d72f28d6bf91215a224b110dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= <765740+giordano@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:46:30 +0100 Subject: [PATCH 2/2] Update contrib/generate_precompile.jl Co-authored-by: Ian Butterworth --- contrib/generate_precompile.jl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/contrib/generate_precompile.jl b/contrib/generate_precompile.jl index 58c8fb2fe8998..037e8926d5003 100644 --- a/contrib/generate_precompile.jl +++ b/contrib/generate_precompile.jl @@ -184,10 +184,9 @@ for match = Base._methods(+, (Int, Int), -1, Base.get_world_counter()) write(IOBuffer(), "") # Not critical, but helps hide unrelated compilation from @time when using --trace-compile. - # Do not call `rand` which can cause bad caching on some platforms: #56177. - f55729() = ones(2, 2) * ones(2, 2) - @time f55729() - @time f55729() + f55729() = Base.Experimental.@force_compile + @time @eval f55729() + @time @eval f55729() break # only actually need to do this once end