diff --git a/Project.toml b/Project.toml index 4f5b456..7a85619 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/src/ZMQ.jl b/src/ZMQ.jl index f57be26..348a2a2 100644 --- a/src/ZMQ.jl +++ b/src/ZMQ.jl @@ -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