mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2026-10-14 05:41:54 +00:00
[PR #131] [MERGED] Experimental bench runtime opt #158
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
amnezia-vpn/amneziawg-go#158
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/amnezia-vpn/amneziawg-go/pull/131
Author: @FrogRocky
Created: 4/2/2026
Status: ✅ Merged
Merged: 4/3/2026
Merged by: @ygurov
Base:
experimental← Head:experimental-bench-runtime-opt📝 Commits (5)
3075cbdtest(benchmarks): add conn and conceal benchmark suites837dbe8perf(conceal): optimize record and prelude hot paths5d257a5fixes0895b3cfixes58ddc66Merge branch 'experimental-bench' into experimental-bench-runtime-opt📊 Changes
12 files changed (+3923 additions, -56 deletions)
View changed files
➕
conceal/benchmark_helpers_test.go(+581 -0)➕
conceal/benchmark_tcp_test.go(+901 -0)➕
conceal/benchmark_udp_test.go(+1253 -0)📝
conceal/buffer.go(+2 -2)📝
conceal/conn_framed.go(+12 -2)📝
conceal/conn_masquarade.go(+43 -26)➕
conceal/conn_optimizations_test.go(+408 -0)📝
conceal/conn_prelude.go(+50 -20)📝
conceal/rule.go(+2 -2)➕
conceal/slice_buffer.go(+42 -0)➕
conn/benchmark_conn_test.go(+622 -0)📝
conn/bind_std.go(+7 -4)📄 Description
Summary
The main goals are:
concealandconnruntime paths measurable in a repeatable wayWhat Changed
Benchmark coverage
Added dedicated benchmark suites for the paths this work is targeting:
StdNetBindsend/receive benchmarksConceal hot-path optimizations
Optimized the core record/prelude write/read plumbing by:
bytes.NewBufferusage with narrow slice-backed helpersFlexBuffer/ context construction where possibledeferfrom targeted write pathswriteContext.Len()Follow-up runtime fixes
Applied two small local runtime optimizations discovered during regression follow-up:
FramedBatchConn.WriteBatch: explicit pooled-buffer cleanup instead of loop-localdeferStdNetBind.receiveIP: initialize only the single message slot actually used by the fallbackReadMsgUDPpathRegression coverage
Added focused conceal-side regression tests for:
Benchmark Results
Environment:
goos: linuxgoarch: amd64cpu: Intel(R) Xeon(R) Silver 4210R CPU @ 2.40GHzold.txt=experimentalnew.txt= this branchn=10Headline results
concealgeomeansec/op:518.0ns -> 446.1ns(-13.88%)concealgeomeanB/op:-17.53%concealgeomeanallocs/op:-16.38%concealgeomean throughput:+16.11%conngeomeansec/op:427.5ns -> 411.1ns(-3.83%)conngeomeanB/op: flatconngeomeanallocs/op: flatconngeomean throughput:+3.90%Notable wins
TCPRecordMasquerade/WriteRecord/mixed-4:-21.10%TCPPrelude/Write/initiation_mixed-4:-25.71%TCPPipeline/Write/full_pipeline/mixed:-15.24%UDPMasquerade/Write/mixed-4:-15.39%UDPPrelude/Write/initiation_mixed-4:-23.77%UDPBatchMasquerade/Write/batch64/mixed_transport:-28.92%UDPBatchFramed/Write/batch64/compat_off/transport_small:-30.30%UDPBatchPrelude/Write/batch64/mixed_initiation_presence:-29.33%UDPBatchPipeline/Write/batch64/full_pipeline/mixed_initiation_presence:-34.12%ConnStdNetBindReceive/batch:-5.48%ConnStdNetBindReceive/batch_rx_offload:-7.00%Regressions
The attached Linux run shows one meaningful
sec/opregression:UDPBatchFramed/Read/batch8/compat_on/initiation-4:+3.51%🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.