{"action":"closed","issue":{"url":"https://api.github.com/repos/JuliaInterop/ZMQ.jl/issues/142","repository_url":"https://api.github.com/repos/JuliaInterop/ZMQ.jl","labels_url":"https://api.github.com/repos/JuliaInterop/ZMQ.jl/issues/142/labels{/name}","comments_url":"https://api.github.com/repos/JuliaInterop/ZMQ.jl/issues/142/comments","events_url":"https://api.github.com/repos/JuliaInterop/ZMQ.jl/issues/142/events","html_url":"https://github.com/JuliaInterop/ZMQ.jl/issues/142","id":221706014,"number":142,"title":"get_events slows down send, can it be moved or removed?","user":{"login":"ggggggggg","id":5192577,"avatar_url":"https://avatars2.githubusercontent.com/u/5192577?v=4","gravatar_id":"","url":"https://api.github.com/users/ggggggggg","html_url":"https://github.com/ggggggggg","followers_url":"https://api.github.com/users/ggggggggg/followers","following_url":"https://api.github.com/users/ggggggggg/following{/other_user}","gists_url":"https://api.github.com/users/ggggggggg/gists{/gist_id}","starred_url":"https://api.github.com/users/ggggggggg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ggggggggg/subscriptions","organizations_url":"https://api.github.com/users/ggggggggg/orgs","repos_url":"https://api.github.com/users/ggggggggg/repos","events_url":"https://api.github.com/users/ggggggggg/events{/privacy}","received_events_url":"https://api.github.com/users/ggggggggg/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-04-13T23:15:18Z","updated_at":"2017-09-01T22:42:57Z","closed_at":"2017-09-01T22:42:57Z","author_association":"NONE","body":"See [this thread for context](https://discourse.julialang.org/t/zmq-message-super-slow/3193/5). I made a version of `send` (`sendfast` below) that removed `get_events`. When I benchmark vs send as follow\r\n```julia\r\nm=Message(\"1\")\r\n@benchmark send(s,m)\r\n@benchmark ZMQ.sendfast(s,m)\r\n```\r\nI find that the time per `send` is about 1.5 us, and the time per `sendfast` is about 0.1 us, so about 15 times faster for small message. If I simply redefine `send` with `get_events` removed, all the tests pass. So I'm wondering if `get_events` can just be removed and I'm guessing the answer is no. To demonstrate that, it would be great to have a test that fails is `get_events` is removed. \r\n\r\nIf it can't be removed, should `sendfast` or something like it be defined?\r\n\r\n```julia \r\nfunction sendfast(socket::Socket, zmsg::Message, SNDMORE::Bool=false)\r\n  while true\r\n      rc = ccall((:zmq_msg_send, zmq), Cint, (Ptr{Message}, Ptr{Void}, Cint),\r\n                  &zmsg, socket.data, (ZMQ_SNDMORE*SNDMORE) | ZMQ_DONTWAIT)\r\n      if rc == -1\r\n          zmq_errno() == EAGAIN || throw(StateError(jl_zmq_error_str()))\r\n          while (get_events(socket) & POLLOUT) == 0\r\n              wait(socket)\r\n          end\r\n      else\r\n          #get_events(socket) != 0 && notify(socket)\r\n          notify(socket)\r\n          break\r\n      end\r\n  end\r\nend\r\n```"}}
{"actor":{"display_login":"Keno"}}