Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stear the user towards let #40

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct OtherType
str::String
end

@setup_workload begin
@setup_workload let
# Putting some things in `@setup_workload` instead of `@compile_workload` can reduce the size of the
# precompile file and potentially make loading faster.
list = [OtherType("hello"), OtherType("world!")]
Expand Down
4 changes: 2 additions & 2 deletions src/workloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ macro compile_workload(ex::Expr)
end

"""
@setup_workload begin
@setup_workload let
vars = ...
end

Run the code block only during package precompilation. `@setup_workload` is often used in combination
with [`@compile_workload`](@ref), for example:

@setup_workload begin
@setup_workload let
vars = ...
@compile_workload begin
y = f(vars...)
Expand Down
2 changes: 1 addition & 1 deletion test/PC_A/src/PC_A.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function call_findfirst(x, list)
return findfirst(==(inferencebarrier(x)), inferencebarrier(list))
end

@setup_workload begin
@setup_workload let
list = [MyType(1), MyType(2), MyType(3)]
@compile_workload begin
call_findfirst(MyType(2), list)
Expand Down
2 changes: 1 addition & 1 deletion test/PC_C/src/PC_C.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module RB
end
using .RB

@setup_workload begin
@setup_workload let
struct Foo end
@compile_workload begin
@recipe f(::Foo) = nothing
Expand Down
2 changes: 1 addition & 1 deletion test/PC_D/src/PC_D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module PC_D
using PrecompileTools
using PrecompileTools.Preferences

@setup_workload begin
@setup_workload let
@compile_workload begin
global workload_ran = true
end
Expand Down
2 changes: 1 addition & 1 deletion test/PC_E/src/PC_E.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ g(list) = [f(x) for x in list]

using PrecompileTools

@setup_workload begin
@setup_workload let
list = Any[1, "hi"]
@compile_workload begin
for item in list
Expand Down
Loading