Skip to content
Merged
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
25 changes: 25 additions & 0 deletions JuliaLowering/src/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,29 @@ if Base.get_bool_env("JULIA_LOWERING_PRECOMPILE", true)
lwr = to_lowered_expr(lwrst)
@assert Meta.isexpr(lwr, :thunk) && only(lwr.args) isa Core.CodeInfo
end

workload = raw"""
_precompile_kwf(x; y=1, z=2) = x + y + z

function _precompile_destr(t)
(a, b) = t
a + b
end

macro _precompile_plus1(ex)
:($ex + 1)
end
_precompile_usemac(x) = @_precompile_plus1(x)

@generated function _precompile_genf(x)
:(x + 1)
end

# Fire everything so inference and the generator run during the build.
_precompile_kwf(1; y = 2)
_precompile_destr((1, 2))
_precompile_usemac(3)
_precompile_genf(1.0)
"""
include_string(@__MODULE__, workload, @__FILE__)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it would also be fine to migrate the thunks code above to the include_string approach.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm going to merge this as-is, since tweaks would need a re-measurement and PkgEval seems pretty happy with this configuration (we are <~2x flisp to lower most packages w/ #62302 - only a couple of poorly scaling exceptions)

end
Loading