Repository navigation
Benchmark MASQUE, HTTPS and SSH; reduce MASQUE UDP allocations - #133
Merged
Merged
Conversation
andre487
force-pushed
the
benchmark-transports
branch
from
October 27, 2026 15:44
c35a1f2 to
30505e6
Compare
andre487
changed the base branch from
native-benchmarks
to
optimize-socks5-udp
October 27, 2026 15:50
andre487
force-pushed
the
benchmark-transports
branch
from
October 27, 2026 15:51
30505e6 to
448ab5b
Compare
andre487
force-pushed
the
benchmark-transports
branch
from
October 27, 2026 16:06
448ab5b to
a19cf5a
Compare
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.
Pull request stack
GitHub stack #135.
Merge order: #131 → #132 → #133.
Base: #132. Each PR contains only its own change relative to its parent. After merging lower layers, use
gh stack syncto update local tracking and restack the remaining branches.Result
Add reproducible encrypted-loopback benchmarks for MASQUE, HTTPS and SSH, and remove two measured per-datagram allocation sources in MASQUE. This PR is stacked on #132, which inherits the Fastlane benchmark runner from #131.
MASQUE now parses the existing byte slice with quicvarint.Parse instead of allocating bytes.Reader. Its UDP peer checks compare valid numeric endpoints directly, preserving IP/port/IPv6 zone checks and the textual fallback for other address types. Apply the same peer check to its direct-UDP wrapper. QUIC ownership/copies, datagram limits, deadlines, trust and source-validation policy remain intact.
Benchmarks
Run sequentially through
bundle exec fastlane android native_benchmarkswithbench:BenchmarkTransportMASQUE,bench:BenchmarkTransportHTTPS, thenbench:BenchmarkTransportSSH. They are opt-in; the default CPU-only suite remains unchanged.Ten 200 ms samples per scenario on Apple M4 Pro, GOMAXPROCS=1. All peers bind loopback and echo inside the proxy/channel; no external origin, Internet, personal credentials or Docker is used. One operation is a warm sequential round trip, including both encrypted endpoints in the process-wide CPU/allocation metrics; bytes count both directions. Setup and first exchange are outside the timer. SSH stalls have a closing watchdog because native SSH channels do not support socket deadlines.
Findings
MASQUE UDP loses 7 allocations and approximately 112 B per round trip, consistently for both sizes and deadline policies:
These totals include QUIC and the echo peer, not just the client wrapper. Unchanged stream controls also showed timing drift, so no end-to-end latency improvement is claimed.
HTTPS HTTP/2 profiles primarily show system I/O and TLS/HTTP2 library work; the HTTP/3 bulk allocation profile is dominated by UDP/QUIC packet handling. SSH's allocation profile attributes roughly 95% to x/crypto/ssh.connectionState.readPacket. No comparable avoidable application-layer operation was established in those stream paths; no third-party library edits were made.
EN/RU documentation describes commands, profile analysis, measurement boundaries and limitations: no cold handshakes, concurrency/loss/stress, jump chains, sustained rotation/rekey, TUN/JNI or Android bandwidth claims. Real GOST/OpenSSH interoperability remains the separate Docker integration suite.
Validation
APK artifacts
Built from commit
a19cf5a9by CI run #448.Artifacts expire after 14 days. Neither APK uses the MegaProxy release key.