Skip to content

feat: preserve receive capacity when guests retain zero-copy buffers - #2109

Draft
andreiltd wants to merge 1 commit into
tandr/streams/return-tuplesfrom
tandr/streams/zero-copy
Draft

andreiltd wants to merge 1 commit into
tandr/streams/return-tuplesfrom
tandr/streams/zero-copy

Conversation

@andreiltd

Copy link
Copy Markdown
Member

Stack created with GitHub Stacks CLI • Give Feedback 💬

@andreiltd
andreiltd added this pull request to stack #2110 November 25, 2026 17:58
@andreiltd andreiltd changed the title tandr/streams/zero copy feat: preserve receive capacity when guests retain zero-copy buffers Nov 25, 2026
@andreiltd andreiltd added the C-enhancement For PRs adding features, improving functionality, docs, tests, etc. label Nov 25, 2026
@hyperlight-gh-bot

This comment has been minimized.

@andreiltd
andreiltd force-pushed the tandr/streams/zero-copy branch from cdd1c4c to ff6ceb2 Compare November 26, 2026 13:35
@hyperlight-gh-bot

This comment has been minimized.

Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
@andreiltd
andreiltd force-pushed the tandr/streams/zero-copy branch from ff6ceb2 to e780d86 Compare December 1, 2026 17:29
@hyperlight-gh-bot

Copy link
Copy Markdown

Benchmark Results

Measured commit: e780d86eae0f
Baseline commit: e672ceee7227

kvm / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 281.84 ns (➖ 1.06x faster)
vec_bytes 85.21 ns (➖ 1.17x slower)
391.52 µs (➖ 1.00x slower)

payload_allocation

slot_pool_segmented
65536 147.89 ns (➖ 1.05x slower)
262144 595.21 ns (➖ 1.14x slower)

sandboxes

create_initialized_and_drop
medium 14.16 ms (➖ 1.01x slower)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
8.20 ns (➖ 1.06x slower) 8.30 ns (➖ 1.07x slower) 8.08 ns (➖ 1.05x slower)

snapshot_files

load_snapshot_unverified
small 112.19 µs (➖ 1.02x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 1.93 µs (➖ 1.08x faster) 2.03 µs (➖ 1.06x slower)
262144 10.03 µs (➖ 1.42x slower) 7.31 µs (➖ 1.07x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 6.32 µs (➖ 1.03x faster) 6.24 µs (➖ 1.02x faster)
262144 28.29 µs (➖ 1.04x slower)
8192 1.05 µs (➖ 1.04x slower) 1.10 µs (➖ 1.07x slower)
kvm / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 255.00 ns (➖ 1.10x faster)
vec_bytes 83.56 ns (➖ 1.10x slower)
673.25 µs (➖ 1.01x slower)

payload_allocation

slot_pool_segmented
65536 141.60 ns (➖ 1.05x slower)
262144 546.33 ns (➖ 1.09x slower)

sandboxes

create_initialized_and_drop
medium 14.56 ms (➖ 1.08x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
7.27 ns (➖ 1.06x slower) 7.30 ns (➖ 1.06x slower) 7.28 ns (➖ 1.05x slower)

snapshot_files

load_snapshot_unverified
small 53.62 µs (➖ 1.00x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.14 µs (➖ 1.01x slower) 2.10 µs (➖ 1.02x faster)
262144 7.54 µs (➖ 1.01x slower) 7.53 µs (➖ 1.00x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 6.93 µs (➖ 1.03x faster) 7.03 µs (➖ 1.01x faster)
262144 29.59 µs (➖ 1.01x faster)
8192 715.33 ns (➖ 1.01x faster) 742.41 ns (➖ 1.01x slower)
mshv3 / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 349.62 ns (➖ 1.07x faster)
vec_bytes 104.95 ns (➖ 1.06x slower)
314.22 µs (➖ 1.04x faster)

payload_allocation

slot_pool_segmented
65536 187.56 ns (➖ 1.03x slower)
262144 695.69 ns (➖ 1.03x slower)

sandboxes

create_initialized_and_drop
medium 63.40 ms (➖ 1.10x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
10.37 ns (➖ 1.05x slower) 10.37 ns (➖ 1.05x slower) 10.48 ns (➖ 1.06x slower)

snapshot_files

load_snapshot_unverified
small 98.42 µs (➖ 1.03x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.52 µs (➖ 1.03x slower) 2.68 µs (➖ 1.00x slower)
262144 9.31 µs (➖ 1.04x slower) 9.54 µs (➖ 1.13x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 7.96 µs (➖ 1.00x faster) 8.02 µs (➖ 1.03x faster)
262144 34.90 µs (➖ 1.01x faster)
8192 1.29 µs (➖ 1.02x slower) 1.28 µs (➖ 1.01x slower)
mshv3 / intel (Linux) (❌ 1.90x)

Top regressions

  • slot_pool/alloc_dealloc_4096 — ❌ 1.90x slower

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 365.98 ns (➖ 1.09x faster)
vec_bytes 85.68 ns (➖ 1.00x slower)
705.85 µs (➖ 1.09x faster)

payload_allocation

slot_pool_segmented
65536 170.04 ns (➖ 1.01x faster)
262144 645.42 ns (➖ 1.02x slower)

sandboxes

create_initialized_and_drop
medium 54.88 ms (➖ 1.40x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
16.50 ns (❌ 1.90x slower) 9.08 ns (➖ 1.00x slower) 9.09 ns (➖ 1.04x slower)

snapshot_files

load_snapshot_unverified
small 53.22 µs (➖ 1.01x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.27 µs (➖ 1.01x slower) 2.26 µs (➖ 1.01x slower)
262144 8.01 µs (➖ 1.00x slower) 7.98 µs (➖ 1.01x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 7.41 µs (➖ 1.01x faster) 7.51 µs (➖ 1.01x faster)
262144 37.65 µs (➖ 1.04x faster)
8192 905.17 ns (➖ 1.04x faster) 889.16 ns (➖ 1.03x faster)
hyperv-ws2025 / amd (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 521.61 ns (➖ 1.01x slower)
vec_bytes 154.30 ns (➖ 1.11x slower)
3.97 ms (➖ 1.02x faster)

payload_allocation

slot_pool_segmented
65536 257.10 ns (➖ 1.12x slower)
262144 885.14 ns (➖ 1.12x slower)

sandboxes

create_initialized_and_drop
medium 13.01 ms (➖ 1.09x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
12.12 ns (➖ 1.17x slower) 12.27 ns (➖ 1.22x slower) 12.40 ns (➖ 1.20x slower)

snapshot_files

load_snapshot_unverified
small 729.09 µs (➖ 1.02x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.58 µs (➖ 1.10x slower) 2.39 µs (➖ 1.04x slower)
262144 9.11 µs (➖ 1.05x faster) 11.09 µs (➖ 1.23x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 9.27 µs (➖ 1.04x slower) 9.47 µs (➖ 1.05x slower)
262144 38.69 µs (➖ 1.01x slower)
8192 1.29 µs (➖ 1.02x faster) 1.30 µs (➖ 1.01x slower)
hyperv-ws2025 / intel (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 478.99 ns (➖ 1.02x slower)
vec_bytes 127.38 ns (➖ 1.05x slower)
3.29 ms (➖ 1.01x faster)

payload_allocation

slot_pool_segmented
65536 229.09 ns (➖ 1.16x slower)
262144 821.35 ns (➖ 1.19x slower)

sandboxes

create_initialized_and_drop
medium 15.10 ms (➖ 1.03x slower)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
10.63 ns (➖ 1.20x slower) 10.76 ns (➖ 1.21x slower) 10.69 ns (➖ 1.20x slower)

snapshot_files

load_snapshot_unverified
small 491.45 µs (➖ 1.02x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.65 µs (➖ 1.03x slower) 2.69 µs (➖ 1.04x slower)
262144 9.00 µs (➖ 1.02x slower) 9.07 µs (➖ 1.02x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 9.47 µs (➖ 1.01x slower) 9.55 µs (➖ 1.00x slower)
262144 41.45 µs (➖ 1.09x faster)
8192 1.13 µs (➖ 1.01x faster) 1.12 µs (➖ 1.02x slower)

Reported by cargo ci bench-report --candidate run:46703677819 --config-file bench_report.toml.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-enhancement For PRs adding features, improving functionality, docs, tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant