Created
April 20, 2014 00:40
-
-
Save binarybana/11101773 to your computer and use it in GitHub Desktop.
ZMQ.jl Ping Pong Performance Benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ZMQ | |
ctx = Context(1) | |
s = Socket(ctx, ZMQ.REQ) | |
ZMQ.connect(s, "tcp://localhost:7001") | |
gc_disable() | |
readline() | |
for i=1:20 | |
tic() | |
ZMQ.send(s, "ping") | |
msg = ZMQ.recv(s) | |
toc() | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zmq | |
import time | |
ctx = zmq.Context() | |
socket = ctx.socket(zmq.REQ) | |
socket.connect('tcp://127.0.0.1:7001') | |
raw_input() | |
for i in range(20): | |
t1 = time.time() | |
socket.send("ping") | |
msg = socket.recv() | |
print(time.time() - t1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zmq | |
import time | |
ctx = zmq.Context() | |
socket = ctx.socket(zmq.REP) | |
socket.bind('tcp://*:7001') | |
while True: | |
msg = socket.recv() | |
socket.send("pong") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ZMQ | |
ctx = Context(1) | |
s = Socket(ctx, ZMQ.REP) | |
ZMQ.bind(s, "tcp://*:7001") | |
while true | |
msg = ZMQ.recv(s) | |
ZMQ.send(s, "pong") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment