Modernize sockets to Network.framework#50
Draft
ccahoon wants to merge 8 commits into
Draft
Conversation
Replaces the vendored CocoaAsyncSocket stack with nw_* primitives across F53OSCSocket, F53OSCBrowser, and F53OSCServer. F53OSCClient is unchanged on the public surface. Cribbed from F53OSC-Swift: - Vectorized SLIP encoder and decoder. ~6x encode, ~2.3x decode on typical OSC payloads, validated by a paired legacy/vectorized A/B benchmark in F53OSC_CodecBenchmark. 1.1x near-parity on adversarial high-density- specials input, confirming no regression on worst-case payloads. - SLIP 16 MB frame-size guard with reset-on-overflow. - nw_browser-based service discovery, replacing the deprecated NSNetServiceBrowser path. - F53OSCStats lock-free atomic counters (no more @synchronized). - Tests adapted from the Swift suite. Each header carries an attribution comment naming the source file and pinned revision. F53OSC_ThroughputTests <- OSCThroughputTests.swift F53OSC_StatsTests <- OSCStatsTests.swift F53OSC_SLIPRoundtripTests <- SLIPFramingTests.swift F53OSC_UDPFlowTests <- OSCServerUDPFlowTests.swift Behavior parity additions: - connectTimeout property on F53OSCClient and F53OSCSocket (default 30s). - tcpIdleTimeout property on F53OSCServer, sharing the UDP-flow sweep timer for unified idle-connection cleanup. - Interface binding by name via nw_path_monitor lookup. - Port-0 bind-back. startListening writes the actual OS-assigned port to the .port property, so callers can request 0 and read it back. New tests written for this branch (no Swift analog): - F53OSC_UDPClientHostChangeTest. Verifies the client correctly retargets the underlying nw_connection when client.port or client.host changes. - F53OSC_PerformanceTests. Characterization suite covering one-way latency (TCP and UDP, p50/p99 over 100 samples at low rate), payload throughput (24 B / 256 B / 4 KB across TCP and UDP), 16-producer multi-sender contention (both a kernel-ceiling burst variant and a controlled-burst variant that asserts near-100% delivery), routable- host variant exercising the kernel routing layer, and a 60-second sustained test gated on F53OSC_RUN_SUSTAINED. Documentation: - docs/MODERNIZATION.md: API additions, removed APIs, contract changes from the legacy GCDAsync behavior, the measured kernel UDP receive ceiling on macOS, and known follow-up items. - docs/PARITY_BENCH_PLAN.md and docs/VCR_RECORDER_PLAN.md: scaffolds for the cross-implementation parity bench and the test-utility traffic recorder. Both describe work not yet started.
bed4c6b to
b6c8cd1
Compare
- Measures throughput (UDP/TCP), concurrency (10 TCP clients), and payload encode/decode performance.
…ng from sender side - removes `testMultiSender_UDP_16Producers_ControlledBurst` since existing `testMultiSender_UDP_16Producers` now can assert full delivery.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DO NOT MERGE. proof it's possible and for reference.
i did not watch every line get written on this, but guided many choices and drove test implementation and parity audits with the new swift implementation
The commit message has a lot of details