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 precompilation #224

Merged
merged 3 commits into from
May 7, 2023
Merged
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: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ version = "1.2.2"

[deps]
FileWatching = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
ZeroMQ_jll = "8f1865be-045e-5c20-9c9f-bfbfb0764568"

[compat]
PrecompileTools = "1"
ZeroMQ_jll = "4"
julia = "1.3"

Expand Down
28 changes: 28 additions & 0 deletions src/ZMQ.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,32 @@ function __init__()
end
end

using PrecompileTools
@compile_workload begin
__init__()
# The ZMQ scoping below isn't necessary, but it makes it easier to copy/paste
# the workload to test impact.
s=Socket(PUB)
ZMQ.close(s)

s1=Socket(REP)
s1.sndhwm = 1000
s1.linger = 1
s1.routing_id = "abcd"

s2=Socket(REQ)

ZMQ.bind(s1, "tcp://*:5555")
ZMQ.connect(s2, "tcp://localhost:5555")

msg = Message("test request")

ZMQ.send(s2, msg)
unsafe_string(ZMQ.recv(s1))
ZMQ.send(s1, Message("test response"))
unsafe_string(ZMQ.recv(s2))
ZMQ.close(s1)
ZMQ.close(s2)
end

end