c# - Socket sync send outperform async beginsend/endsend? -
i writing tcp server supports lot of(50,000+) connection, , found out this.
the sync send performed @ least 3 times better async one. programs identical besides these 2 lines:
m_socket.send(sendingbuffer, length, socketflags.none); and
m_socket.beginsend(sendingbuffer, 0, length, 0, new asynccallback(sendcallback), this); in sendcallback call endsend, nothing else.
where huge performance difference coming from? aren't async methods supposed perform better?
async methods slower sync methods (due involving added overhead in implementation), overall "faster" if need while executing - if waiting them finish, unnecessary.
Comments
Post a Comment