Skip to content

Conversation

@KristofferC
Copy link
Member

@KristofferC KristofferC commented Mar 24, 2023

There doesn't seem to be any noticeable latency from this. Using a test file:

using Test
@testset "test" begin
    @test 1==1
end

With this PR I get:

❯ time ./julia --startup-file=no time_test.jl  
Test Summary: | Pass  Total  Time
test          |    1      1  0.0s
./julia --startup-file=no time_test.jl  0.42s user 0.77s system 447% cpu 0.266 total

and on 1.9:

❯ time julia --startup-file=no time_test.jl 
Test Summary: | Pass  Total  Time
test          |    1      1  0.0s
julia --startup-file=no time_test.jl  0.40s user 0.75s system 511% cpu 0.225 total

@KristofferC KristofferC added the stdlib Julia's standard library label Mar 24, 2023
@KristofferC KristofferC requested a review from vchuravy March 24, 2023 11:40
precompile(Tuple{typeof(Test.filter_errors), Test.DefaultTestSet})
# TODO: Check which of the explicit precompile statments above are still needed
# with the workload below active.
@testset "example" begin
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prints to stderr which is not so pretty

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can stderr be redirected or would that ruin the precompilation effectiveness?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also for some reason this is getting printed again again in the tests when it should only happen during pkgimage precompilation once

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They all print from the same worker so maybe there is some test running a bunch of processes with --compiled-modules=no that loads Test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also printed twice when compiling Julia:

    JULIA stdlib/DelimitedFiles.release.image
    JULIA stdlib/LibSSH2_jll.release.image
    JULIA stdlib/SharedArrays.release.image
    JULIA stdlib/Profile.release.image
Test Summary: | Pass  Total  Time
example       |    1      1  0.1s
    JULIA stdlib/Test.release.image
    JULIA stdlib/SparseArrays.release.image
Test Summary: | Pass  Total  Time
example       |    1      1  0.1s

Seems it should only be once (when it is compiled)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, one with bounds and one without. So two total

Copy link
Member Author

@KristofferC KristofferC Apr 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It comes from:

julia/test/loading.jl

Lines 1089 to 1105 in bd1a664

for (P, D, C, I, O) in Iterators.product(0:1, 0:2, 0:2, 0:1, 0:3)
julia = joinpath(Sys.BINDIR, Base.julia_exename())
script = """
using Test
let
cf = Base.CacheFlags()
opts = Base.JLOptions()
@test cf.use_pkgimages == opts.use_pkgimages == $P
@test cf.debug_level == opts.debug_level == $D
@test cf.check_bounds == opts.check_bounds == $C
@test cf.inline == opts.can_inline == $I
@test cf.opt_level == opts.opt_level == $O
end
"""
cmd = `$julia $(pkgimage(P)) $(opt_level(O)) $(debug_level(D)) $(check_bounds(C)) $(inline(I)) -e $script`
@test success(pipeline(cmd; stdout, stderr))
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps all these precompiles should be guarded to happen during precompilation only like SnoopCompile ones are?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the usage of Test completely from this test.

@KristofferC
Copy link
Member Author

I wonder how the precompile tests that fail are relying on that Test is in the sysimage.

@KristofferC KristofferC force-pushed the kc/test_sysimage branch 3 times, most recently from a546197 to 7090399 Compare April 5, 2023 13:07
@KristofferC KristofferC merged commit 6bfb7fb into master Apr 5, 2023
@KristofferC KristofferC deleted the kc/test_sysimage branch April 5, 2023 16:23
Xnartharax pushed a commit to Xnartharax/julia that referenced this pull request Apr 19, 2023
Keno pushed a commit that referenced this pull request Jun 5, 2024
@ViralBShah ViralBShah mentioned this pull request Oct 16, 2025
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stdlib Julia's standard library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants