I've just tested performance of TCP server/client in Julia REPL and find
results pretty disappointing. The server is as simple as:
server = listen(2000)
while true
sock = accept(server)
begin
while true
@time readbytes(sock, 1024*1024)
end
end
end
It listens on 2000 port for a single connection and than starts reading
from it chunks of 1Mb.
Client is not much harder:
sock = connect(2000)
Mb = rand(UInt8, 1024*1024) # 1 Mb of data
for i=1:1_000 write(sock, Mb) end
Basically it simply writes 1Gb of data in chunk of 1Mb. When I run these
snippets in 2 different REPL windows, from the server one I get the
following:
0.393481 seconds (2 allocations: 1.000 MB)
0.406101 seconds (2 allocations: 1.000 MB)
0.424946 seconds (2 allocations: 1.000 MB)
0.410651 seconds (2 allocations: 1.000 MB)
0.406987 seconds (2 allocations: 1.000 MB)
0.386872 seconds (2 allocations: 1.000 MB)
0.399998 seconds (40 allocations: 1.001 MB)
I.e. speed of data transfer is about 2.5 Mb/sec. I'm pretty much sure my
local network interface can do much better. Am I doing something wrong?