You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Sockets, Distributed, Serialization
function srvr()
ls = listen(10000)
while true
as = accept(ls)
@async begin
while true
msg=deserialize(as)
if isa(msg, Function)
msg();
serialize(as, ()->1)
else
serialize(as, msg)
end
end
end
end
end
srvr()
in one process.
In a REPL
using Sockets, Distributed, Serialization
function testc_data(n)
c = connect("localhost", 10000)
@time for i in 1:n
msg = serialize(c, 1)
resp = deserialize(c)
@assert resp == 1
end
end
function testc_func(n)
c = connect("localhost", 10000)
@time for i in 1:n
msg = serialize(c, ()->1)
resp = deserialize(c)
@assert resp() == 1
end
end
Since the underlying model is function execution, as opposed to data messaging, just optimizing this will speed up parallel code that does a lot of remote calls.
@carnaval , originally the server code was not within a function. It is still slower but not as bad.
The text was updated successfully, but these errors were encountered:
Run
in one process.
In a REPL
Results
Since the underlying model is function execution, as opposed to data messaging, just optimizing this will speed up parallel code that does a lot of remote calls.
@carnaval , originally the server code was not within a function. It is still slower but not as bad.
The text was updated successfully, but these errors were encountered: