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

Add minor precompile workload #750

Closed
wants to merge 3 commits into from
Closed
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
3 changes: 3 additions & 0 deletions src/HTTP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -626,4 +626,7 @@ function Base.parse(::Type{T}, str::AbstractString)::T where T <: Message
return m
end

include("precompile.jl")
_precompile_()

end # module
16 changes: 16 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
_precompile_()

Run some tiny workloads that the package should precompile.
"""
function _precompile_()
rikhuijzer marked this conversation as resolved.
Show resolved Hide resolved
ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
VERSION < v"1.5" && return nothing

try
r = HTTP.get("http://127.0.0.1"; connect_timeout=1, retry=false)
io = IOBuffer()
show(io, r)
catch
end
end