I have ported my code from BSD sockets over to Network.framework, and while blocking issues remain (https://forums.developer.apple.com/forums/thread/747815) and while I can not yet properly instrument my code because os_signpost
does not seem to work on XCTestCases
profiled directly from Xcode (https://forums.developer.apple.com/forums/thread/748059) I do already have some initial observations.
Perf test case of sending full (~1280 bytes) UDP datagrams back and forth over lo0
indicates that BSD sockets code can achieve 20% higher throughput (in packets per second) than Network.framework based code.
That is not what I expected, and I will continue investigating but for the moment I have one question I did not find answer to.
Will using C based Network.framework API instead of Swift based one bring performance gains?
For example, nw_connection_t
provides an interface to send non-contiguous segments of dispatch_data_t
without copying, whereas NWConnection
only deals with contiguous Data
.
Thanks for any insights.