summaryrefslogtreecommitdiffstats
path: root/rust/zerocopy/benches
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-10-02 12:17:24 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-10-02 12:17:24 -0700
commit3f1fe48a36b0b6722dc3fd421d93512bac138e9a (patch)
treeb767d7f6e26bc64334d3f14f8422d187239dc45d /rust/zerocopy/benches
downloadlinux-stable-3f1fe48a36b0b6722dc3fd421d93512bac138e9a.tar.gz
linux-stable-3f1fe48a36b0b6722dc3fd421d93512bac138e9a.zip
Merge tag 'io_uring-7.3-20261002' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linuxgrafted
Pull io_uring fixes from Jens Axboe: - Fix a task_work add use-after-free with SQPOLL. The sqpoll thread could pop and complete the last request while io_req_normal_work_add() was still looking at them after the mpscq push. Use the same approach as DEFER_TASKRUN to protect from that, holding an RCU read lock across the add, and have exit wait for an RCU grace period for SQPOLL rings as well. - CQE32 ring fixes: correct the free entry check for 32b CQEs, zero the big_cqe for aux CQEs, and only post the dummy skip CQE on CQE_MIXED rings - Mark the source filter table as COW when cloning bpf filters, so registering another filter on the source doesn't modify the shared table in place - Initialize the task context before running the BPF loop - Requeue zcrx multishot receives stopped by a local resource - End a TX_TIMESTAMP multishot cmd when the CQ is full (lollipopkit) * tag 'io_uring-7.3-20261002' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: io_uring: fix task_work add use-after-free with SQPOLL io_uring/cmd_net: end TX_TIMESTAMP multishot when the CQ is full io_uring/zcrx: requeue multishot receives stopped by a local resource io_uring: initialize task context before running the BPF loop io_uring: zero big_cqe for aux CQEs on CQE32 rings io_uring: fix free entry check for 32b CQEs on CQE32 rings io_uring: only post the dummy skip CQE on CQE_MIXED rings io_uring/bpf_filter: mark source as COW when cloning filters
Diffstat (limited to 'rust/zerocopy/benches')
-rw-r--r--rust/zerocopy/benches/as_bytes_dynamic_size.rs9
-rw-r--r--rust/zerocopy/benches/as_bytes_dynamic_size.x86-645
-rw-r--r--rust/zerocopy/benches/as_bytes_dynamic_size.x86-64.mca47
-rw-r--r--rust/zerocopy/benches/as_bytes_static_size.rs9
-rw-r--r--rust/zerocopy/benches/as_bytes_static_size.x86-644
-rw-r--r--rust/zerocopy/benches/as_bytes_static_size.x86-64.mca45
-rw-r--r--rust/zerocopy/benches/extend_vec_zeroed.rs9
-rw-r--r--rust/zerocopy/benches/extend_vec_zeroed.x86-6460
-rw-r--r--rust/zerocopy/benches/extend_vec_zeroed.x86-64.mca147
-rw-r--r--rust/zerocopy/benches/formats/coco_dynamic_padding.rs24
-rw-r--r--rust/zerocopy/benches/formats/coco_dynamic_size.rs27
-rw-r--r--rust/zerocopy/benches/formats/coco_static_size.rs27
-rw-r--r--rust/zerocopy/benches/insert_vec_zeroed.rs13
-rw-r--r--rust/zerocopy/benches/insert_vec_zeroed.x86-6479
-rw-r--r--rust/zerocopy/benches/insert_vec_zeroed.x86-64.mca183
-rw-r--r--rust/zerocopy/benches/new_box_zeroed.rs9
-rw-r--r--rust/zerocopy/benches/new_box_zeroed.x86-647
-rw-r--r--rust/zerocopy/benches/new_box_zeroed.x86-64.mca51
-rw-r--r--rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_padding.rs11
-rw-r--r--rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_padding.x86-6424
-rw-r--r--rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_padding.x86-64.mca81
-rw-r--r--rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_size.rs9
-rw-r--r--rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_size.x86-6422
-rw-r--r--rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_size.x86-64.mca77
-rw-r--r--rust/zerocopy/benches/new_vec_zeroed.rs9
-rw-r--r--rust/zerocopy/benches/new_vec_zeroed.x86-6440
-rw-r--r--rust/zerocopy/benches/new_vec_zeroed.x86-64.mca113
-rw-r--r--rust/zerocopy/benches/new_zeroed.rs9
-rw-r--r--rust/zerocopy/benches/new_zeroed.x86-643
-rw-r--r--rust/zerocopy/benches/new_zeroed.x86-64.mca43
-rw-r--r--rust/zerocopy/benches/read_from_bytes.rs7
-rw-r--r--rust/zerocopy/benches/read_from_bytes.x86-6415
-rw-r--r--rust/zerocopy/benches/read_from_bytes.x86-64.mca65
-rw-r--r--rust/zerocopy/benches/read_from_prefix.rs10
-rw-r--r--rust/zerocopy/benches/read_from_prefix.x86-6414
-rw-r--r--rust/zerocopy/benches/read_from_prefix.x86-64.mca63
-rw-r--r--rust/zerocopy/benches/read_from_suffix.rs10
-rw-r--r--rust/zerocopy/benches/read_from_suffix.x86-6415
-rw-r--r--rust/zerocopy/benches/read_from_suffix.x86-64.mca65
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_dynamic_padding.rs7
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_dynamic_padding.x86-6422
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_dynamic_padding.x86-64.mca77
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_dynamic_size.rs7
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_dynamic_size.x86-6420
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_dynamic_size.x86-64.mca75
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_static_size.rs7
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_static_size.x86-648
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_static_size.x86-64.mca53
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_padding.rs10
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_padding.x86-6419
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_padding.x86-64.mca71
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_size.rs10
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_size.x86-6416
-rw-r--r--rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_size.x86-64.mca65
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_dynamic_padding.rs10
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_dynamic_padding.x86-6422
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_dynamic_padding.x86-64.mca77
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_dynamic_size.rs10
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_dynamic_size.x86-6417
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_dynamic_size.x86-64.mca67
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_static_size.rs10
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_static_size.x86-648
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_static_size.x86-64.mca53
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_padding.rs13
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_padding.x86-6426
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_padding.x86-64.mca85
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_size.rs13
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_size.x86-6422
-rw-r--r--rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_size.x86-64.mca77
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_dynamic_padding.rs10
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_dynamic_padding.x86-6423
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_dynamic_padding.x86-64.mca79
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_dynamic_size.rs10
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_dynamic_size.x86-6413
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_dynamic_size.x86-64.mca63
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_static_size.rs10
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_static_size.x86-6413
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_static_size.x86-64.mca61
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_padding.rs13
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_padding.x86-6427
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_padding.x86-64.mca85
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_size.rs13
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_size.x86-6423
-rw-r--r--rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_size.x86-64.mca77
-rw-r--r--rust/zerocopy/benches/split_at_dynamic_padding.rs12
-rw-r--r--rust/zerocopy/benches/split_at_dynamic_padding.x86-6412
-rw-r--r--rust/zerocopy/benches/split_at_dynamic_padding.x86-64.mca59
-rw-r--r--rust/zerocopy/benches/split_at_dynamic_size.rs12
-rw-r--r--rust/zerocopy/benches/split_at_dynamic_size.x86-6412
-rw-r--r--rust/zerocopy/benches/split_at_dynamic_size.x86-64.mca59
-rw-r--r--rust/zerocopy/benches/split_at_unchecked_dynamic_padding.rs12
-rw-r--r--rust/zerocopy/benches/split_at_unchecked_dynamic_padding.x86-646
-rw-r--r--rust/zerocopy/benches/split_at_unchecked_dynamic_padding.x86-64.mca49
-rw-r--r--rust/zerocopy/benches/split_at_unchecked_dynamic_size.rs12
-rw-r--r--rust/zerocopy/benches/split_at_unchecked_dynamic_size.x86-646
-rw-r--r--rust/zerocopy/benches/split_at_unchecked_dynamic_size.x86-64.mca49
-rw-r--r--rust/zerocopy/benches/split_via_immutable_dynamic_padding.rs11
-rw-r--r--rust/zerocopy/benches/split_via_immutable_dynamic_padding.x86-6414
-rw-r--r--rust/zerocopy/benches/split_via_immutable_dynamic_padding.x86-64.mca65
-rw-r--r--rust/zerocopy/benches/split_via_immutable_dynamic_size.rs11
-rw-r--r--rust/zerocopy/benches/split_via_immutable_dynamic_size.x86-6413
-rw-r--r--rust/zerocopy/benches/split_via_immutable_dynamic_size.x86-64.mca63
-rw-r--r--rust/zerocopy/benches/split_via_runtime_check_dynamic_padding.rs11
-rw-r--r--rust/zerocopy/benches/split_via_runtime_check_dynamic_padding.x86-6422
-rw-r--r--rust/zerocopy/benches/split_via_runtime_check_dynamic_padding.x86-64.mca79
-rw-r--r--rust/zerocopy/benches/split_via_runtime_check_dynamic_size.rs11
-rw-r--r--rust/zerocopy/benches/split_via_runtime_check_dynamic_size.x86-6413
-rw-r--r--rust/zerocopy/benches/split_via_runtime_check_dynamic_size.x86-64.mca63
-rw-r--r--rust/zerocopy/benches/split_via_unchecked_dynamic_padding.rs11
-rw-r--r--rust/zerocopy/benches/split_via_unchecked_dynamic_padding.x86-6414
-rw-r--r--rust/zerocopy/benches/split_via_unchecked_dynamic_padding.x86-64.mca65
-rw-r--r--rust/zerocopy/benches/split_via_unchecked_dynamic_size.rs11
-rw-r--r--rust/zerocopy/benches/split_via_unchecked_dynamic_size.x86-6413
-rw-r--r--rust/zerocopy/benches/split_via_unchecked_dynamic_size.x86-64.mca63
-rw-r--r--rust/zerocopy/benches/transmute.rs16
-rw-r--r--rust/zerocopy/benches/transmute.x86-643
-rw-r--r--rust/zerocopy/benches/transmute.x86-64.mca43
-rw-r--r--rust/zerocopy/benches/transmute_ref_dynamic_size.rs16
-rw-r--r--rust/zerocopy/benches/transmute_ref_dynamic_size.x86-644
-rw-r--r--rust/zerocopy/benches/transmute_ref_dynamic_size.x86-64.mca45
-rw-r--r--rust/zerocopy/benches/transmute_ref_static_size.rs15
-rw-r--r--rust/zerocopy/benches/transmute_ref_static_size.x86-643
-rw-r--r--rust/zerocopy/benches/transmute_ref_static_size.x86-64.mca43
-rw-r--r--rust/zerocopy/benches/try_read_from_bytes.rs7
-rw-r--r--rust/zerocopy/benches/try_read_from_bytes.x86-6423
-rw-r--r--rust/zerocopy/benches/try_read_from_bytes.x86-64.mca79
-rw-r--r--rust/zerocopy/benches/try_read_from_prefix.rs10
-rw-r--r--rust/zerocopy/benches/try_read_from_prefix.x86-6416
-rw-r--r--rust/zerocopy/benches/try_read_from_prefix.x86-64.mca67
-rw-r--r--rust/zerocopy/benches/try_read_from_suffix.rs10
-rw-r--r--rust/zerocopy/benches/try_read_from_suffix.x86-6418
-rw-r--r--rust/zerocopy/benches/try_read_from_suffix.x86-64.mca71
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_dynamic_padding.rs7
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_dynamic_padding.x86-6424
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_dynamic_padding.x86-64.mca81
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_dynamic_size.rs7
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_dynamic_size.x86-6422
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_dynamic_size.x86-64.mca79
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_static_size.rs7
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_static_size.x86-6413
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_static_size.x86-64.mca59
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_padding.rs10
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_padding.x86-6421
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_padding.x86-64.mca75
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_size.rs10
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_size.x86-6418
-rw-r--r--rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_size.x86-64.mca69
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_dynamic_padding.rs10
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_dynamic_padding.x86-6429
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_dynamic_padding.x86-64.mca91
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_dynamic_size.rs10
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_dynamic_size.x86-6422
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_dynamic_size.x86-64.mca77
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_static_size.rs10
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_static_size.x86-6415
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_static_size.x86-64.mca63
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.rs13
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.x86-6430
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.x86-64.mca91
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_size.rs13
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_size.x86-6426
-rw-r--r--rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_size.x86-64.mca83
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_dynamic_padding.rs10
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_dynamic_padding.x86-6426
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_dynamic_padding.x86-64.mca85
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_dynamic_size.rs10
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_dynamic_size.x86-6418
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_dynamic_size.x86-64.mca71
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_static_size.rs10
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_static_size.x86-6416
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_static_size.x86-64.mca67
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_padding.rs13
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_padding.x86-6432
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_padding.x86-64.mca95
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_size.rs13
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_size.x86-6428
-rw-r--r--rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_size.x86-64.mca87
-rw-r--r--rust/zerocopy/benches/try_transmute.rs16
-rw-r--r--rust/zerocopy/benches/try_transmute.x86-649
-rw-r--r--rust/zerocopy/benches/try_transmute.x86-64.mca55
-rw-r--r--rust/zerocopy/benches/try_transmute_ref_dynamic_size.rs18
-rw-r--r--rust/zerocopy/benches/try_transmute_ref_dynamic_size.x86-646
-rw-r--r--rust/zerocopy/benches/try_transmute_ref_dynamic_size.x86-64.mca49
-rw-r--r--rust/zerocopy/benches/try_transmute_ref_static_size.rs17
-rw-r--r--rust/zerocopy/benches/try_transmute_ref_static_size.x86-645
-rw-r--r--rust/zerocopy/benches/try_transmute_ref_static_size.x86-64.mca47
-rw-r--r--rust/zerocopy/benches/write_to_dynamic_size.rs9
-rw-r--r--rust/zerocopy/benches/write_to_dynamic_size.x86-6421
-rw-r--r--rust/zerocopy/benches/write_to_dynamic_size.x86-64.mca77
-rw-r--r--rust/zerocopy/benches/write_to_prefix_dynamic_size.rs12
-rw-r--r--rust/zerocopy/benches/write_to_prefix_dynamic_size.x86-6421
-rw-r--r--rust/zerocopy/benches/write_to_prefix_dynamic_size.x86-64.mca77
-rw-r--r--rust/zerocopy/benches/write_to_prefix_static_size.rs12
-rw-r--r--rust/zerocopy/benches/write_to_prefix_static_size.x86-6411
-rw-r--r--rust/zerocopy/benches/write_to_prefix_static_size.x86-64.mca57
-rw-r--r--rust/zerocopy/benches/write_to_static_size.rs9
-rw-r--r--rust/zerocopy/benches/write_to_static_size.x86-6411
-rw-r--r--rust/zerocopy/benches/write_to_static_size.x86-64.mca57
-rw-r--r--rust/zerocopy/benches/write_to_suffix_dynamic_size.rs12
-rw-r--r--rust/zerocopy/benches/write_to_suffix_dynamic_size.x86-6422
-rw-r--r--rust/zerocopy/benches/write_to_suffix_dynamic_size.x86-64.mca79
-rw-r--r--rust/zerocopy/benches/write_to_suffix_static_size.rs12
-rw-r--r--rust/zerocopy/benches/write_to_suffix_static_size.x86-6411
-rw-r--r--rust/zerocopy/benches/write_to_suffix_static_size.x86-64.mca57
-rw-r--r--rust/zerocopy/benches/zero_dynamic_padding.rs9
-rw-r--r--rust/zerocopy/benches/zero_dynamic_padding.x86-647
-rw-r--r--rust/zerocopy/benches/zero_dynamic_padding.x86-64.mca51
-rw-r--r--rust/zerocopy/benches/zero_dynamic_size.rs9
-rw-r--r--rust/zerocopy/benches/zero_dynamic_size.x86-645
-rw-r--r--rust/zerocopy/benches/zero_dynamic_size.x86-64.mca47
-rw-r--r--rust/zerocopy/benches/zero_static_size.rs9
-rw-r--r--rust/zerocopy/benches/zero_static_size.x86-644
-rw-r--r--rust/zerocopy/benches/zero_static_size.x86-64.mca45
213 files changed, 6940 insertions, 0 deletions
diff --git a/rust/zerocopy/benches/as_bytes_dynamic_size.rs b/rust/zerocopy/benches/as_bytes_dynamic_size.rs
new file mode 100644
index 000000000..68cd1d6f4
--- /dev/null
+++ b/rust/zerocopy/benches/as_bytes_dynamic_size.rs
@@ -0,0 +1,9 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_as_bytes_dynamic_size(source: &format::CocoPacket) -> &[u8] {
+ source.as_bytes()
+}
diff --git a/rust/zerocopy/benches/as_bytes_dynamic_size.x86-64 b/rust/zerocopy/benches/as_bytes_dynamic_size.x86-64
new file mode 100644
index 000000000..f68bad612
--- /dev/null
+++ b/rust/zerocopy/benches/as_bytes_dynamic_size.x86-64
@@ -0,0 +1,5 @@
+bench_as_bytes_dynamic_size:
+ mov rax, rdi
+ lea rdx, [2*rsi + 5]
+ and rdx, -2
+ ret
diff --git a/rust/zerocopy/benches/as_bytes_dynamic_size.x86-64.mca b/rust/zerocopy/benches/as_bytes_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..c3b92a9a9
--- /dev/null
+++ b/rust/zerocopy/benches/as_bytes_dynamic_size.x86-64.mca
@@ -0,0 +1,47 @@
+Iterations: 100
+Instructions: 400
+Total Cycles: 137
+Total uOps: 400
+
+Dispatch Width: 4
+uOps Per Cycle: 2.92
+IPC: 2.92
+Block RThroughput: 1.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.50 lea rdx, [2*rsi + 5]
+ 1 1 0.33 and rdx, -2
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 1.33 1.33 - 1.34 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - 0.66 - 0.34 - - mov rax, rdi
+ - - 0.33 0.67 - - - - lea rdx, [2*rsi + 5]
+ - - 1.00 - - - - - and rdx, -2
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/as_bytes_static_size.rs b/rust/zerocopy/benches/as_bytes_static_size.rs
new file mode 100644
index 000000000..2ad738e95
--- /dev/null
+++ b/rust/zerocopy/benches/as_bytes_static_size.rs
@@ -0,0 +1,9 @@
+use zerocopy::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_as_bytes_static_size(source: &format::CocoPacket) -> &[u8] {
+ source.as_bytes()
+}
diff --git a/rust/zerocopy/benches/as_bytes_static_size.x86-64 b/rust/zerocopy/benches/as_bytes_static_size.x86-64
new file mode 100644
index 000000000..213e74ab5
--- /dev/null
+++ b/rust/zerocopy/benches/as_bytes_static_size.x86-64
@@ -0,0 +1,4 @@
+bench_as_bytes_static_size:
+ mov rax, rdi
+ mov edx, 6
+ ret
diff --git a/rust/zerocopy/benches/as_bytes_static_size.x86-64.mca b/rust/zerocopy/benches/as_bytes_static_size.x86-64.mca
new file mode 100644
index 000000000..ae04a6ba9
--- /dev/null
+++ b/rust/zerocopy/benches/as_bytes_static_size.x86-64.mca
@@ -0,0 +1,45 @@
+Iterations: 100
+Instructions: 300
+Total Cycles: 104
+Total uOps: 300
+
+Dispatch Width: 4
+uOps Per Cycle: 2.88
+IPC: 2.88
+Block RThroughput: 1.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 mov edx, 6
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 0.99 1.00 - 1.01 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.99 - - 0.01 - - mov rax, rdi
+ - - - 1.00 - - - - mov edx, 6
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/extend_vec_zeroed.rs b/rust/zerocopy/benches/extend_vec_zeroed.rs
new file mode 100644
index 000000000..1fbf772d1
--- /dev/null
+++ b/rust/zerocopy/benches/extend_vec_zeroed.rs
@@ -0,0 +1,9 @@
+use zerocopy::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_extend_vec_zeroed(v: &mut Vec<format::LocoPacket>, additional: usize) -> Option<()> {
+ FromZeros::extend_vec_zeroed(v, additional).ok()
+}
diff --git a/rust/zerocopy/benches/extend_vec_zeroed.x86-64 b/rust/zerocopy/benches/extend_vec_zeroed.x86-64
new file mode 100644
index 000000000..831b2a075
--- /dev/null
+++ b/rust/zerocopy/benches/extend_vec_zeroed.x86-64
@@ -0,0 +1,60 @@
+bench_extend_vec_zeroed:
+ push r15
+ push r14
+ push r13
+ push r12
+ push rbx
+ sub rsp, 32
+ mov rbx, rdi
+ mov rax, qword ptr [rdi]
+ mov r12, qword ptr [rdi + 16]
+ mov rcx, rax
+ sub rcx, r12
+ cmp rsi, rcx
+ jbe .LBB6_3
+ mov r15, r12
+ add r15, rsi
+ jae .LBB6_6
+.LBB6_2:
+ xor eax, eax
+ jmp .LBB6_5
+.LBB6_3:
+ mov rax, qword ptr [rbx + 8]
+ lea r15, [r12 + rsi]
+.LBB6_4:
+ lea rcx, [r12 + 2*r12]
+ lea rdi, [rax + 2*rcx]
+ add rsi, rsi
+ lea rdx, [rsi + 2*rsi]
+ xor esi, esi
+ call qword ptr [rip + memset@GOTPCREL]
+ mov qword ptr [rbx + 16], r15
+ mov al, 1
+.LBB6_5:
+ add rsp, 32
+ pop rbx
+ pop r12
+ pop r13
+ pop r14
+ pop r15
+ ret
+.LBB6_6:
+ mov r13, rsi
+ lea rcx, [rax + rax]
+ cmp r15, rcx
+ cmova rcx, r15
+ cmp rcx, 5
+ mov r14d, 4
+ cmovae r14, rcx
+ mov rdx, qword ptr [rbx + 8]
+ lea rdi, [rsp + 8]
+ mov rsi, rax
+ mov rcx, r14
+ call <alloc::raw_vec::RawVecInner>::finish_grow
+ cmp dword ptr [rsp + 8], 1
+ je .LBB6_2
+ mov rax, qword ptr [rsp + 16]
+ mov qword ptr [rbx + 8], rax
+ mov qword ptr [rbx], r14
+ mov rsi, r13
+ jmp .LBB6_4
diff --git a/rust/zerocopy/benches/extend_vec_zeroed.x86-64.mca b/rust/zerocopy/benches/extend_vec_zeroed.x86-64.mca
new file mode 100644
index 000000000..cfab1eea8
--- /dev/null
+++ b/rust/zerocopy/benches/extend_vec_zeroed.x86-64.mca
@@ -0,0 +1,147 @@
+Iterations: 100
+Instructions: 5400
+Total Cycles: 6595
+Total uOps: 6800
+
+Dispatch Width: 4
+uOps Per Cycle: 1.03
+IPC: 0.82
+Block RThroughput: 17.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 2 5 1.00 * push r15
+ 2 5 1.00 * push r14
+ 2 5 1.00 * push r13
+ 2 5 1.00 * push r12
+ 2 5 1.00 * push rbx
+ 1 1 0.33 sub rsp, 32
+ 1 1 0.33 mov rbx, rdi
+ 1 5 0.50 * mov rax, qword ptr [rdi]
+ 1 5 0.50 * mov r12, qword ptr [rdi + 16]
+ 1 1 0.33 mov rcx, rax
+ 1 1 0.33 sub rcx, r12
+ 1 1 0.33 cmp rsi, rcx
+ 1 1 1.00 jbe .LBB6_3
+ 1 1 0.33 mov r15, r12
+ 1 1 0.33 add r15, rsi
+ 1 1 1.00 jae .LBB6_6
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 jmp .LBB6_5
+ 1 5 0.50 * mov rax, qword ptr [rbx + 8]
+ 1 1 0.50 lea r15, [r12 + rsi]
+ 1 1 0.50 lea rcx, [r12 + 2*r12]
+ 1 1 0.50 lea rdi, [rax + 2*rcx]
+ 1 1 0.33 add rsi, rsi
+ 1 1 0.50 lea rdx, [rsi + 2*rsi]
+ 1 0 0.25 xor esi, esi
+ 4 7 1.00 * call qword ptr [rip + memset@GOTPCREL]
+ 1 1 1.00 * mov qword ptr [rbx + 16], r15
+ 1 1 0.33 mov al, 1
+ 1 1 0.33 add rsp, 32
+ 1 6 0.50 * pop rbx
+ 1 6 0.50 * pop r12
+ 1 6 0.50 * pop r13
+ 1 6 0.50 * pop r14
+ 1 6 0.50 * pop r15
+ 1 1 1.00 U ret
+ 1 1 0.33 mov r13, rsi
+ 1 1 0.50 lea rcx, [rax + rax]
+ 1 1 0.33 cmp r15, rcx
+ 3 3 1.00 cmova rcx, r15
+ 1 1 0.33 cmp rcx, 5
+ 1 1 0.33 mov r14d, 4
+ 2 2 0.67 cmovae r14, rcx
+ 1 5 0.50 * mov rdx, qword ptr [rbx + 8]
+ 1 1 0.50 lea rdi, [rsp + 8]
+ 1 1 0.33 mov rsi, rax
+ 1 1 0.33 mov rcx, r14
+ 3 5 1.00 call <alloc::raw_vec::RawVecInner>::finish_grow
+ 2 6 0.50 * cmp dword ptr [rsp + 8], 1
+ 1 1 1.00 je .LBB6_2
+ 1 5 0.50 * mov rax, qword ptr [rsp + 16]
+ 1 1 1.00 * mov qword ptr [rbx + 8], rax
+ 1 1 1.00 * mov qword ptr [rbx], r14
+ 1 1 0.33 mov rsi, r13
+ 1 1 1.00 jmp .LBB6_4
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 12.00 12.00 10.00 13.00 11.00 11.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - 1.00 - 0.49 0.51 push r15
+ - - - - 1.00 - 0.51 0.49 push r14
+ - - - - 1.00 - 0.50 0.50 push r13
+ - - - - 1.00 - 0.50 0.50 push r12
+ - - - - 1.00 - 0.50 0.50 push rbx
+ - - 0.01 0.99 - - - - sub rsp, 32
+ - - - - - 1.00 - - mov rbx, rdi
+ - - - - - - 0.50 0.50 mov rax, qword ptr [rdi]
+ - - - - - - 0.50 0.50 mov r12, qword ptr [rdi + 16]
+ - - - 1.00 - - - - mov rcx, rax
+ - - - 0.99 - 0.01 - - sub rcx, r12
+ - - - - - 1.00 - - cmp rsi, rcx
+ - - - - - 1.00 - - jbe .LBB6_3
+ - - 0.01 0.98 - 0.01 - - mov r15, r12
+ - - 0.99 0.01 - - - - add r15, rsi
+ - - - - - 1.00 - - jae .LBB6_6
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - jmp .LBB6_5
+ - - - - - - 0.50 0.50 mov rax, qword ptr [rbx + 8]
+ - - 1.00 - - - - - lea r15, [r12 + rsi]
+ - - 0.98 0.02 - - - - lea rcx, [r12 + 2*r12]
+ - - 0.99 0.01 - - - - lea rdi, [rax + 2*rcx]
+ - - - 1.00 - - - - add rsi, rsi
+ - - 0.99 0.01 - - - - lea rdx, [rsi + 2*rsi]
+ - - - - - - - - xor esi, esi
+ - - - - 1.00 1.00 1.00 1.00 call qword ptr [rip + memset@GOTPCREL]
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rbx + 16], r15
+ - - 0.01 0.99 - - - - mov al, 1
+ - - 1.00 - - - - - add rsp, 32
+ - - - - - - 0.50 0.50 pop rbx
+ - - - - - - 0.50 0.50 pop r12
+ - - - - - - 0.50 0.50 pop r13
+ - - - - - - 0.50 0.50 pop r14
+ - - - - - - 0.50 0.50 pop r15
+ - - - - - 1.00 - - ret
+ - - 1.00 - - - - - mov r13, rsi
+ - - 0.01 0.99 - - - - lea rcx, [rax + rax]
+ - - 0.99 0.01 - - - - cmp r15, rcx
+ - - 2.00 0.01 - 0.99 - - cmova rcx, r15
+ - - 0.01 0.99 - - - - cmp rcx, 5
+ - - 0.01 0.99 - - - - mov r14d, 4
+ - - 1.00 0.01 - 0.99 - - cmovae r14, rcx
+ - - - - - - 0.50 0.50 mov rdx, qword ptr [rbx + 8]
+ - - 0.01 0.99 - - - - lea rdi, [rsp + 8]
+ - - - 1.00 - - - - mov rsi, rax
+ - - - 0.01 - 0.99 - - mov rcx, r14
+ - - - - 1.00 1.00 0.50 0.50 call <alloc::raw_vec::RawVecInner>::finish_grow
+ - - - 0.99 - 0.01 0.50 0.50 cmp dword ptr [rsp + 8], 1
+ - - - - - 1.00 - - je .LBB6_2
+ - - - - - - 0.50 0.50 mov rax, qword ptr [rsp + 16]
+ - - - - 1.00 - 0.49 0.51 mov qword ptr [rbx + 8], rax
+ - - - - 1.00 - 0.51 0.49 mov qword ptr [rbx], r14
+ - - 0.99 0.01 - - - - mov rsi, r13
+ - - - - - 1.00 - - jmp .LBB6_4
diff --git a/rust/zerocopy/benches/formats/coco_dynamic_padding.rs b/rust/zerocopy/benches/formats/coco_dynamic_padding.rs
new file mode 100644
index 000000000..e494bce67
--- /dev/null
+++ b/rust/zerocopy/benches/formats/coco_dynamic_padding.rs
@@ -0,0 +1,24 @@
+use zerocopy_derive::*;
+
+// The only valid value of this type are the bytes `0xC0C0`.
+#[derive(TryFromBytes, KnownLayout, Immutable)]
+#[repr(u16)]
+pub enum C0C0 {
+ _XC0C0 = 0xC0C0,
+}
+
+#[derive(FromBytes, KnownLayout, Immutable, SplitAt)]
+#[repr(C, align(4))]
+pub struct Packet<Magic> {
+ magic_number: Magic,
+ milk: u8,
+ mug_size: u8,
+ temperature: [u8; 5],
+ marshmallows: [[u8; 3]],
+}
+
+/// A packet begining with the magic number `0xC0C0`.
+pub type CocoPacket = Packet<C0C0>;
+
+/// A packet beginning with any two initialized bytes.
+pub type LocoPacket = Packet<[u8; 2]>;
diff --git a/rust/zerocopy/benches/formats/coco_dynamic_size.rs b/rust/zerocopy/benches/formats/coco_dynamic_size.rs
new file mode 100644
index 000000000..59364638e
--- /dev/null
+++ b/rust/zerocopy/benches/formats/coco_dynamic_size.rs
@@ -0,0 +1,27 @@
+use zerocopy_derive::*;
+
+// The only valid value of this type are the bytes `0xC0C0`.
+#[derive(TryFromBytes, KnownLayout, Immutable, IntoBytes)]
+#[repr(u16)]
+pub enum C0C0 {
+ _XC0C0 = 0xC0C0,
+}
+
+macro_rules! define_packet {
+ ($name: ident, $trait: ident, $leading_field: ty) => {
+ #[derive($trait, KnownLayout, Immutable, IntoBytes, SplitAt)]
+ #[repr(C, align(2))]
+ pub struct $name {
+ magic_number: $leading_field,
+ mug_size: u8,
+ temperature: u8,
+ marshmallows: [[u8; 2]],
+ }
+ };
+}
+
+/// Packet begins with bytes 0xC0C0.
+define_packet!(CocoPacket, TryFromBytes, C0C0);
+
+/// Packet begins with any two bytes.
+define_packet!(LocoPacket, FromBytes, [u8; 2]);
diff --git a/rust/zerocopy/benches/formats/coco_static_size.rs b/rust/zerocopy/benches/formats/coco_static_size.rs
new file mode 100644
index 000000000..0839497e1
--- /dev/null
+++ b/rust/zerocopy/benches/formats/coco_static_size.rs
@@ -0,0 +1,27 @@
+use zerocopy_derive::*;
+
+// The only valid value of this type are the bytes `0xC0C0`.
+#[derive(TryFromBytes, KnownLayout, Immutable, IntoBytes)]
+#[repr(u16)]
+pub enum C0C0 {
+ _XC0C0 = 0xC0C0,
+}
+
+macro_rules! define_packet {
+ ($name: ident, $trait: ident, $leading_field: ty) => {
+ #[derive($trait, KnownLayout, Immutable, IntoBytes)]
+ #[repr(C, align(2))]
+ pub struct $name {
+ magic_number: $leading_field,
+ mug_size: u8,
+ temperature: u8,
+ marshmallows: [u8; 2],
+ }
+ };
+}
+
+/// Packet begins with bytes 0xC0C0.
+define_packet!(CocoPacket, TryFromBytes, C0C0);
+
+/// Packet begins with any two bytes.
+define_packet!(LocoPacket, FromBytes, [u8; 2]);
diff --git a/rust/zerocopy/benches/insert_vec_zeroed.rs b/rust/zerocopy/benches/insert_vec_zeroed.rs
new file mode 100644
index 000000000..a5d685c2b
--- /dev/null
+++ b/rust/zerocopy/benches/insert_vec_zeroed.rs
@@ -0,0 +1,13 @@
+use zerocopy::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_insert_vec_zeroed(
+ v: &mut Vec<format::LocoPacket>,
+ position: usize,
+ additional: usize,
+) -> Option<()> {
+ FromZeros::insert_vec_zeroed(v, position, additional).ok()
+}
diff --git a/rust/zerocopy/benches/insert_vec_zeroed.x86-64 b/rust/zerocopy/benches/insert_vec_zeroed.x86-64
new file mode 100644
index 000000000..9db87403c
--- /dev/null
+++ b/rust/zerocopy/benches/insert_vec_zeroed.x86-64
@@ -0,0 +1,79 @@
+bench_insert_vec_zeroed:
+ push rbp
+ push r15
+ push r14
+ push r13
+ push r12
+ push rbx
+ sub rsp, 24
+ mov r12, qword ptr [rdi + 16]
+ mov r13, r12
+ sub r13, rsi
+ jb .LBB6_10
+ mov rbx, rdi
+ mov rax, qword ptr [rdi]
+ mov rcx, rax
+ sub rcx, r12
+ cmp rdx, rcx
+ jbe .LBB6_4
+ add r12, rdx
+ jae .LBB6_7
+.LBB6_3:
+ xor eax, eax
+ jmp .LBB6_6
+.LBB6_4:
+ mov rax, qword ptr [rbx + 8]
+ add r12, rdx
+.LBB6_5:
+ lea rcx, [rsi + 2*rsi]
+ lea r14, [rax + 2*rcx]
+ add rdx, rdx
+ lea r15, [rdx + 2*rdx]
+ lea rdi, [r14 + r15]
+ add r13, r13
+ lea rdx, [2*r13]
+ add rdx, r13
+ mov rsi, r14
+ call qword ptr [rip + memmove@GOTPCREL]
+ mov rdi, r14
+ xor esi, esi
+ mov rdx, r15
+ call qword ptr [rip + memset@GOTPCREL]
+ mov qword ptr [rbx + 16], r12
+ mov al, 1
+.LBB6_6:
+ add rsp, 24
+ pop rbx
+ pop r12
+ pop r13
+ pop r14
+ pop r15
+ pop rbp
+ ret
+.LBB6_7:
+ mov r15, rsi
+ mov rbp, rdx
+ lea rcx, [rax + rax]
+ cmp r12, rcx
+ cmova rcx, r12
+ cmp rcx, 5
+ mov r14d, 4
+ cmovae r14, rcx
+ mov rdx, qword ptr [rbx + 8]
+ mov rdi, rsp
+ mov rsi, rax
+ mov rcx, r14
+ call <alloc::raw_vec::RawVecInner>::finish_grow
+ cmp dword ptr [rsp], 1
+ je .LBB6_3
+ mov rax, qword ptr [rsp + 8]
+ mov qword ptr [rbx + 8], rax
+ mov qword ptr [rbx], r14
+ mov rdx, rbp
+ mov rsi, r15
+ jmp .LBB6_5
+.LBB6_10:
+ lea rdi, [rip + .Lanon.HASH.1]
+ lea rdx, [rip + .Lanon.HASH.3]
+ mov esi, 37
+ call qword ptr [rip + core::panicking::panic@GOTPCREL]
diff --git a/rust/zerocopy/benches/insert_vec_zeroed.x86-64.mca b/rust/zerocopy/benches/insert_vec_zeroed.x86-64.mca
new file mode 100644
index 000000000..665240667
--- /dev/null
+++ b/rust/zerocopy/benches/insert_vec_zeroed.x86-64.mca
@@ -0,0 +1,183 @@
+Iterations: 100
+Instructions: 7200
+Total Cycles: 7648
+Total uOps: 9300
+
+Dispatch Width: 4
+uOps Per Cycle: 1.22
+IPC: 0.94
+Block RThroughput: 23.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 2 5 1.00 * push rbp
+ 2 5 1.00 * push r15
+ 2 5 1.00 * push r14
+ 2 5 1.00 * push r13
+ 2 5 1.00 * push r12
+ 2 5 1.00 * push rbx
+ 1 1 0.33 sub rsp, 24
+ 1 5 0.50 * mov r12, qword ptr [rdi + 16]
+ 1 1 0.33 mov r13, r12
+ 1 1 0.33 sub r13, rsi
+ 1 1 1.00 jb .LBB6_10
+ 1 1 0.33 mov rbx, rdi
+ 1 5 0.50 * mov rax, qword ptr [rdi]
+ 1 1 0.33 mov rcx, rax
+ 1 1 0.33 sub rcx, r12
+ 1 1 0.33 cmp rdx, rcx
+ 1 1 1.00 jbe .LBB6_4
+ 1 1 0.33 add r12, rdx
+ 1 1 1.00 jae .LBB6_7
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 jmp .LBB6_6
+ 1 5 0.50 * mov rax, qword ptr [rbx + 8]
+ 1 1 0.33 add r12, rdx
+ 1 1 0.50 lea rcx, [rsi + 2*rsi]
+ 1 1 0.50 lea r14, [rax + 2*rcx]
+ 1 1 0.33 add rdx, rdx
+ 1 1 0.50 lea r15, [rdx + 2*rdx]
+ 1 1 0.50 lea rdi, [r14 + r15]
+ 1 1 0.33 add r13, r13
+ 1 1 0.50 lea rdx, [2*r13]
+ 1 1 0.33 add rdx, r13
+ 1 1 0.33 mov rsi, r14
+ 4 7 1.00 * call qword ptr [rip + memmove@GOTPCREL]
+ 1 1 0.33 mov rdi, r14
+ 1 0 0.25 xor esi, esi
+ 1 1 0.33 mov rdx, r15
+ 4 7 1.00 * call qword ptr [rip + memset@GOTPCREL]
+ 1 1 1.00 * mov qword ptr [rbx + 16], r12
+ 1 1 0.33 mov al, 1
+ 1 1 0.33 add rsp, 24
+ 1 6 0.50 * pop rbx
+ 1 6 0.50 * pop r12
+ 1 6 0.50 * pop r13
+ 1 6 0.50 * pop r14
+ 1 6 0.50 * pop r15
+ 1 6 0.50 * pop rbp
+ 1 1 1.00 U ret
+ 1 1 0.33 mov r15, rsi
+ 1 1 0.33 mov rbp, rdx
+ 1 1 0.50 lea rcx, [rax + rax]
+ 1 1 0.33 cmp r12, rcx
+ 3 3 1.00 cmova rcx, r12
+ 1 1 0.33 cmp rcx, 5
+ 1 1 0.33 mov r14d, 4
+ 2 2 0.67 cmovae r14, rcx
+ 1 5 0.50 * mov rdx, qword ptr [rbx + 8]
+ 1 1 0.33 mov rdi, rsp
+ 1 1 0.33 mov rsi, rax
+ 1 1 0.33 mov rcx, r14
+ 3 5 1.00 call <alloc::raw_vec::RawVecInner>::finish_grow
+ 2 6 0.50 * cmp dword ptr [rsp], 1
+ 1 1 1.00 je .LBB6_3
+ 1 5 0.50 * mov rax, qword ptr [rsp + 8]
+ 1 1 1.00 * mov qword ptr [rbx + 8], rax
+ 1 1 1.00 * mov qword ptr [rbx], r14
+ 1 1 0.33 mov rdx, rbp
+ 1 1 0.33 mov rsi, r15
+ 1 1 1.00 jmp .LBB6_5
+ 1 1 0.50 lea rdi, [rip + .Lanon.HASH.1]
+ 1 1 0.50 lea rdx, [rip + .Lanon.HASH.3]
+ 1 1 0.33 mov esi, 37
+ 4 7 1.00 * call qword ptr [rip + core::panicking::panic@GOTPCREL]
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 17.02 16.50 13.00 19.48 14.00 14.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - 1.00 - 0.98 0.02 push rbp
+ - - - - 1.00 - 0.02 0.98 push r15
+ - - - - 1.00 - 0.99 0.01 push r14
+ - - - - 1.00 - 0.01 0.99 push r13
+ - - - - 1.00 - 0.99 0.01 push r12
+ - - - - 1.00 - 0.01 0.99 push rbx
+ - - 0.49 0.51 - - - - sub rsp, 24
+ - - - - - - 0.04 0.96 mov r12, qword ptr [rdi + 16]
+ - - 0.49 0.50 - 0.01 - - mov r13, r12
+ - - 0.48 0.51 - 0.01 - - sub r13, rsi
+ - - - - - 1.00 - - jb .LBB6_10
+ - - 0.49 0.49 - 0.02 - - mov rbx, rdi
+ - - - - - - 0.97 0.03 mov rax, qword ptr [rdi]
+ - - 0.51 0.49 - - - - mov rcx, rax
+ - - 0.49 0.02 - 0.49 - - sub rcx, r12
+ - - 0.49 0.50 - 0.01 - - cmp rdx, rcx
+ - - - - - 1.00 - - jbe .LBB6_4
+ - - 0.02 0.49 - 0.49 - - add r12, rdx
+ - - - - - 1.00 - - jae .LBB6_7
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - jmp .LBB6_6
+ - - - - - - 0.97 0.03 mov rax, qword ptr [rbx + 8]
+ - - 0.51 0.49 - - - - add r12, rdx
+ - - 0.49 0.51 - - - - lea rcx, [rsi + 2*rsi]
+ - - 0.50 0.50 - - - - lea r14, [rax + 2*rcx]
+ - - 0.51 0.49 - - - - add rdx, rdx
+ - - 0.50 0.50 - - - - lea r15, [rdx + 2*rdx]
+ - - 0.49 0.51 - - - - lea rdi, [r14 + r15]
+ - - 0.50 0.49 - 0.01 - - add r13, r13
+ - - 0.51 0.49 - - - - lea rdx, [2*r13]
+ - - 0.01 0.01 - 0.98 - - add rdx, r13
+ - - 0.01 - - 0.99 - - mov rsi, r14
+ - - - - 1.00 1.00 1.98 0.02 call qword ptr [rip + memmove@GOTPCREL]
+ - - 0.49 0.50 - 0.01 - - mov rdi, r14
+ - - - - - - - - xor esi, esi
+ - - 0.50 0.50 - - - - mov rdx, r15
+ - - - - 1.00 1.00 1.96 0.04 call qword ptr [rip + memset@GOTPCREL]
+ - - - - 1.00 - 0.01 0.99 mov qword ptr [rbx + 16], r12
+ - - 0.50 - - 0.50 - - mov al, 1
+ - - 0.51 0.49 - - - - add rsp, 24
+ - - - - - - 0.02 0.98 pop rbx
+ - - - - - - 0.03 0.97 pop r12
+ - - - - - - 0.03 0.97 pop r13
+ - - - - - - 0.97 0.03 pop r14
+ - - - - - - 0.03 0.97 pop r15
+ - - - - - - 0.01 0.99 pop rbp
+ - - - - - 1.00 - - ret
+ - - 0.49 0.51 - - - - mov r15, rsi
+ - - 0.51 0.49 - - - - mov rbp, rdx
+ - - 0.49 0.51 - - - - lea rcx, [rax + rax]
+ - - 0.49 0.50 - 0.01 - - cmp r12, rcx
+ - - 1.04 0.50 - 1.46 - - cmova rcx, r12
+ - - 0.49 0.49 - 0.02 - - cmp rcx, 5
+ - - 0.50 - - 0.50 - - mov r14d, 4
+ - - 0.50 0.51 - 0.99 - - cmovae r14, rcx
+ - - - - - - 0.97 0.03 mov rdx, qword ptr [rbx + 8]
+ - - - 0.51 - 0.49 - - mov rdi, rsp
+ - - 0.01 0.50 - 0.49 - - mov rsi, rax
+ - - 0.49 0.50 - 0.01 - - mov rcx, r14
+ - - - - 1.00 1.00 0.99 0.01 call <alloc::raw_vec::RawVecInner>::finish_grow
+ - - 0.51 0.49 - - 0.50 0.50 cmp dword ptr [rsp], 1
+ - - - - - 1.00 - - je .LBB6_3
+ - - - - - - 0.50 0.50 mov rax, qword ptr [rsp + 8]
+ - - - - 1.00 - 0.99 0.01 mov qword ptr [rbx + 8], rax
+ - - - - 1.00 - 0.01 0.99 mov qword ptr [rbx], r14
+ - - 0.49 0.50 - 0.01 - - mov rdx, rbp
+ - - 0.50 0.01 - 0.49 - - mov rsi, r15
+ - - - - - 1.00 - - jmp .LBB6_5
+ - - 0.01 0.99 - - - - lea rdi, [rip + .Lanon.HASH.1]
+ - - 0.99 0.01 - - - - lea rdx, [rip + .Lanon.HASH.3]
+ - - 0.02 0.49 - 0.49 - - mov esi, 37
+ - - - - 1.00 1.00 0.02 1.98 call qword ptr [rip + core::panicking::panic@GOTPCREL]
diff --git a/rust/zerocopy/benches/new_box_zeroed.rs b/rust/zerocopy/benches/new_box_zeroed.rs
new file mode 100644
index 000000000..aa9a66cce
--- /dev/null
+++ b/rust/zerocopy/benches/new_box_zeroed.rs
@@ -0,0 +1,9 @@
+use zerocopy::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_new_box_zeroed() -> Option<Box<format::LocoPacket>> {
+ FromZeros::new_box_zeroed().ok()
+}
diff --git a/rust/zerocopy/benches/new_box_zeroed.x86-64 b/rust/zerocopy/benches/new_box_zeroed.x86-64
new file mode 100644
index 000000000..ef74ea538
--- /dev/null
+++ b/rust/zerocopy/benches/new_box_zeroed.x86-64
@@ -0,0 +1,7 @@
+bench_new_box_zeroed:
+ push rax
+ call qword ptr [rip + __rustc::__rust_no_alloc_shim_is_unstable_v2@GOTPCREL]
+ mov edi, 6
+ mov esi, 2
+ pop rax
+ jmp qword ptr [rip + __rustc::__rust_alloc_zeroed@GOTPCREL]
diff --git a/rust/zerocopy/benches/new_box_zeroed.x86-64.mca b/rust/zerocopy/benches/new_box_zeroed.x86-64.mca
new file mode 100644
index 000000000..05afa7feb
--- /dev/null
+++ b/rust/zerocopy/benches/new_box_zeroed.x86-64.mca
@@ -0,0 +1,51 @@
+Iterations: 100
+Instructions: 600
+Total Cycles: 1197
+Total uOps: 1100
+
+Dispatch Width: 4
+uOps Per Cycle: 0.92
+IPC: 0.50
+Block RThroughput: 2.8
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 2 5 1.00 * push rax
+ 4 7 1.00 * call qword ptr [rip + __rustc::__rust_no_alloc_shim_is_unstable_v2@GOTPCREL]
+ 1 1 0.33 mov edi, 6
+ 1 1 0.33 mov esi, 2
+ 1 6 0.50 * pop rax
+ 2 6 1.00 * jmp qword ptr [rip + __rustc::__rust_alloc_zeroed@GOTPCREL]
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 0.99 1.00 2.00 2.01 2.07 2.93
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - 1.00 - 0.93 0.07 push rax
+ - - - - 1.00 1.00 0.12 1.88 call qword ptr [rip + __rustc::__rust_no_alloc_shim_is_unstable_v2@GOTPCREL]
+ - - 0.99 - - 0.01 - - mov edi, 6
+ - - - 1.00 - - - - mov esi, 2
+ - - - - - - 0.94 0.06 pop rax
+ - - - - - 1.00 0.08 0.92 jmp qword ptr [rip + __rustc::__rust_alloc_zeroed@GOTPCREL]
diff --git a/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_padding.rs b/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_padding.rs
new file mode 100644
index 000000000..0afde999b
--- /dev/null
+++ b/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_padding.rs
@@ -0,0 +1,11 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_new_box_zeroed_with_elems_dynamic_padding(
+ count: usize,
+) -> Option<Box<format::LocoPacket>> {
+ FromZeros::new_box_zeroed_with_elems(count).ok()
+}
diff --git a/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_padding.x86-64 b/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_padding.x86-64
new file mode 100644
index 000000000..22a8d048c
--- /dev/null
+++ b/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_padding.x86-64
@@ -0,0 +1,24 @@
+bench_new_box_zeroed_with_elems_dynamic_padding:
+ push r14
+ push rbx
+ push rax
+ mov rbx, rdi
+ movabs rax, 3074457345618258598
+ cmp rdi, rax
+ ja .LBB5_1
+ lea r14, [rbx + 2*rbx]
+ or r14, 3
+ add r14, 9
+ call qword ptr [rip + __rustc::__rust_no_alloc_shim_is_unstable_v2@GOTPCREL]
+ mov esi, 4
+ mov rdi, r14
+ call qword ptr [rip + __rustc::__rust_alloc_zeroed@GOTPCREL]
+ jmp .LBB5_3
+.LBB5_1:
+ xor eax, eax
+.LBB5_3:
+ mov rdx, rbx
+ add rsp, 8
+ pop rbx
+ pop r14
+ ret
diff --git a/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..e6efaeded
--- /dev/null
+++ b/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_padding.x86-64.mca
@@ -0,0 +1,81 @@
+Iterations: 100
+Instructions: 2100
+Total Cycles: 2990
+Total uOps: 3000
+
+Dispatch Width: 4
+uOps Per Cycle: 1.00
+IPC: 0.70
+Block RThroughput: 7.5
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 2 5 1.00 * push r14
+ 2 5 1.00 * push rbx
+ 2 5 1.00 * push rax
+ 1 1 0.33 mov rbx, rdi
+ 1 1 0.33 movabs rax, 3074457345618258598
+ 1 1 0.33 cmp rdi, rax
+ 1 1 1.00 ja .LBB5_1
+ 1 1 0.50 lea r14, [rbx + 2*rbx]
+ 1 1 0.33 or r14, 3
+ 1 1 0.33 add r14, 9
+ 4 7 1.00 * call qword ptr [rip + __rustc::__rust_no_alloc_shim_is_unstable_v2@GOTPCREL]
+ 1 1 0.33 mov esi, 4
+ 1 1 0.33 mov rdi, r14
+ 4 7 1.00 * call qword ptr [rip + __rustc::__rust_alloc_zeroed@GOTPCREL]
+ 1 1 1.00 jmp .LBB5_3
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 mov rdx, rbx
+ 1 1 0.33 add rsp, 8
+ 1 6 0.50 * pop rbx
+ 1 6 0.50 * pop r14
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 4.49 4.50 5.00 6.01 4.50 4.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - 1.00 - 0.50 0.50 push r14
+ - - - - 1.00 - 0.50 0.50 push rbx
+ - - - - 1.00 - 0.50 0.50 push rax
+ - - 0.49 0.50 - 0.01 - - mov rbx, rdi
+ - - 0.50 0.50 - - - - movabs rax, 3074457345618258598
+ - - 0.50 0.50 - - - - cmp rdi, rax
+ - - - - - 1.00 - - ja .LBB5_1
+ - - 0.50 0.50 - - - - lea r14, [rbx + 2*rbx]
+ - - 0.50 0.50 - - - - or r14, 3
+ - - 0.50 - - 0.50 - - add r14, 9
+ - - - - 1.00 1.00 1.00 1.00 call qword ptr [rip + __rustc::__rust_no_alloc_shim_is_unstable_v2@GOTPCREL]
+ - - - 0.50 - 0.50 - - mov esi, 4
+ - - 0.50 0.50 - - - - mov rdi, r14
+ - - - - 1.00 1.00 1.00 1.00 call qword ptr [rip + __rustc::__rust_alloc_zeroed@GOTPCREL]
+ - - - - - 1.00 - - jmp .LBB5_3
+ - - - - - - - - xor eax, eax
+ - - 0.51 0.49 - - - - mov rdx, rbx
+ - - 0.49 0.51 - - - - add rsp, 8
+ - - - - - - 0.50 0.50 pop rbx
+ - - - - - - 0.50 0.50 pop r14
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_size.rs b/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_size.rs
new file mode 100644
index 000000000..1b12ca220
--- /dev/null
+++ b/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_size.rs
@@ -0,0 +1,9 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_new_box_zeroed_with_elems_dynamic_size(count: usize) -> Option<Box<format::LocoPacket>> {
+ FromZeros::new_box_zeroed_with_elems(count).ok()
+}
diff --git a/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_size.x86-64 b/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_size.x86-64
new file mode 100644
index 000000000..bff15e55a
--- /dev/null
+++ b/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_size.x86-64
@@ -0,0 +1,22 @@
+bench_new_box_zeroed_with_elems_dynamic_size:
+ push r14
+ push rbx
+ push rax
+ mov rbx, rdi
+ movabs rax, 4611686018427387901
+ cmp rdi, rax
+ ja .LBB5_1
+ lea r14, [2*rbx + 4]
+ call qword ptr [rip + __rustc::__rust_no_alloc_shim_is_unstable_v2@GOTPCREL]
+ mov esi, 2
+ mov rdi, r14
+ call qword ptr [rip + __rustc::__rust_alloc_zeroed@GOTPCREL]
+ jmp .LBB5_3
+.LBB5_1:
+ xor eax, eax
+.LBB5_3:
+ mov rdx, rbx
+ add rsp, 8
+ pop rbx
+ pop r14
+ ret
diff --git a/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_size.x86-64.mca b/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..153d36c01
--- /dev/null
+++ b/rust/zerocopy/benches/new_box_zeroed_with_elems_dynamic_size.x86-64.mca
@@ -0,0 +1,77 @@
+Iterations: 100
+Instructions: 1900
+Total Cycles: 2990
+Total uOps: 2800
+
+Dispatch Width: 4
+uOps Per Cycle: 0.94
+IPC: 0.64
+Block RThroughput: 7.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 2 5 1.00 * push r14
+ 2 5 1.00 * push rbx
+ 2 5 1.00 * push rax
+ 1 1 0.33 mov rbx, rdi
+ 1 1 0.33 movabs rax, 4611686018427387901
+ 1 1 0.33 cmp rdi, rax
+ 1 1 1.00 ja .LBB5_1
+ 1 1 0.50 lea r14, [2*rbx + 4]
+ 4 7 1.00 * call qword ptr [rip + __rustc::__rust_no_alloc_shim_is_unstable_v2@GOTPCREL]
+ 1 1 0.33 mov esi, 2
+ 1 1 0.33 mov rdi, r14
+ 4 7 1.00 * call qword ptr [rip + __rustc::__rust_alloc_zeroed@GOTPCREL]
+ 1 1 1.00 jmp .LBB5_3
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 mov rdx, rbx
+ 1 1 0.33 add rsp, 8
+ 1 6 0.50 * pop rbx
+ 1 6 0.50 * pop r14
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 3.97 3.98 5.00 5.05 4.50 4.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - 1.00 - 0.50 0.50 push r14
+ - - - - 1.00 - 0.50 0.50 push rbx
+ - - - - 1.00 - 0.50 0.50 push rax
+ - - 0.05 0.94 - 0.01 - - mov rbx, rdi
+ - - 0.94 0.06 - - - - movabs rax, 4611686018427387901
+ - - 0.06 0.94 - - - - cmp rdi, rax
+ - - - - - 1.00 - - ja .LBB5_1
+ - - 0.94 0.06 - - - - lea r14, [2*rbx + 4]
+ - - - - 1.00 1.00 1.00 1.00 call qword ptr [rip + __rustc::__rust_no_alloc_shim_is_unstable_v2@GOTPCREL]
+ - - 0.98 0.02 - - - - mov esi, 2
+ - - 0.02 0.94 - 0.04 - - mov rdi, r14
+ - - - - 1.00 1.00 1.00 1.00 call qword ptr [rip + __rustc::__rust_alloc_zeroed@GOTPCREL]
+ - - - - - 1.00 - - jmp .LBB5_3
+ - - - - - - - - xor eax, eax
+ - - 0.94 0.06 - - - - mov rdx, rbx
+ - - 0.04 0.96 - - - - add rsp, 8
+ - - - - - - 0.50 0.50 pop rbx
+ - - - - - - 0.50 0.50 pop r14
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/new_vec_zeroed.rs b/rust/zerocopy/benches/new_vec_zeroed.rs
new file mode 100644
index 000000000..3d95b2b24
--- /dev/null
+++ b/rust/zerocopy/benches/new_vec_zeroed.rs
@@ -0,0 +1,9 @@
+use zerocopy::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_new_vec_zeroed(len: usize) -> Option<Vec<format::LocoPacket>> {
+ FromZeros::new_vec_zeroed(len).ok()
+}
diff --git a/rust/zerocopy/benches/new_vec_zeroed.x86-64 b/rust/zerocopy/benches/new_vec_zeroed.x86-64
new file mode 100644
index 000000000..b5c083aa0
--- /dev/null
+++ b/rust/zerocopy/benches/new_vec_zeroed.x86-64
@@ -0,0 +1,40 @@
+bench_new_vec_zeroed:
+ mov rax, rdi
+ movabs rcx, 1537228672809129301
+ cmp rsi, rcx
+ ja .LBB5_5
+ test rsi, rsi
+ je .LBB5_2
+ push r15
+ push r14
+ push rbx
+ lea rcx, [rsi + rsi]
+ lea rbx, [rcx + 2*rcx]
+ mov r14, rax
+ mov r15, rsi
+ call qword ptr [rip + __rustc::__rust_no_alloc_shim_is_unstable_v2@GOTPCREL]
+ mov esi, 2
+ mov rdi, rbx
+ call qword ptr [rip + __rustc::__rust_alloc_zeroed@GOTPCREL]
+ mov rsi, r15
+ mov rcx, rax
+ mov rax, r14
+ test rcx, rcx
+ pop rbx
+ pop r14
+ pop r15
+ je .LBB5_5
+ mov qword ptr [rax], rsi
+ mov qword ptr [rax + 8], rcx
+ mov qword ptr [rax + 16], rsi
+ ret
+.LBB5_5:
+ movabs rcx, -9223372036854775808
+ mov qword ptr [rax], rcx
+ ret
+.LBB5_2:
+ mov ecx, 2
+ mov qword ptr [rax], rsi
+ mov qword ptr [rax + 8], rcx
+ mov qword ptr [rax + 16], rsi
+ ret
diff --git a/rust/zerocopy/benches/new_vec_zeroed.x86-64.mca b/rust/zerocopy/benches/new_vec_zeroed.x86-64.mca
new file mode 100644
index 000000000..b4fb4544e
--- /dev/null
+++ b/rust/zerocopy/benches/new_vec_zeroed.x86-64.mca
@@ -0,0 +1,113 @@
+Iterations: 100
+Instructions: 3700
+Total Cycles: 3486
+Total uOps: 4600
+
+Dispatch Width: 4
+uOps Per Cycle: 1.32
+IPC: 1.06
+Block RThroughput: 12.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 movabs rcx, 1537228672809129301
+ 1 1 0.33 cmp rsi, rcx
+ 1 1 1.00 ja .LBB5_5
+ 1 1 0.33 test rsi, rsi
+ 1 1 1.00 je .LBB5_2
+ 2 5 1.00 * push r15
+ 2 5 1.00 * push r14
+ 2 5 1.00 * push rbx
+ 1 1 0.50 lea rcx, [rsi + rsi]
+ 1 1 0.50 lea rbx, [rcx + 2*rcx]
+ 1 1 0.33 mov r14, rax
+ 1 1 0.33 mov r15, rsi
+ 4 7 1.00 * call qword ptr [rip + __rustc::__rust_no_alloc_shim_is_unstable_v2@GOTPCREL]
+ 1 1 0.33 mov esi, 2
+ 1 1 0.33 mov rdi, rbx
+ 4 7 1.00 * call qword ptr [rip + __rustc::__rust_alloc_zeroed@GOTPCREL]
+ 1 1 0.33 mov rsi, r15
+ 1 1 0.33 mov rcx, rax
+ 1 1 0.33 mov rax, r14
+ 1 1 0.33 test rcx, rcx
+ 1 6 0.50 * pop rbx
+ 1 6 0.50 * pop r14
+ 1 6 0.50 * pop r15
+ 1 1 1.00 je .LBB5_5
+ 1 1 1.00 * mov qword ptr [rax], rsi
+ 1 1 1.00 * mov qword ptr [rax + 8], rcx
+ 1 1 1.00 * mov qword ptr [rax + 16], rsi
+ 1 1 1.00 U ret
+ 1 1 0.33 movabs rcx, -9223372036854775808
+ 1 1 1.00 * mov qword ptr [rax], rcx
+ 1 1 1.00 U ret
+ 1 1 0.33 mov ecx, 2
+ 1 1 1.00 * mov qword ptr [rax], rsi
+ 1 1 1.00 * mov qword ptr [rax + 8], rcx
+ 1 1 1.00 * mov qword ptr [rax + 16], rsi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 6.99 6.99 12.00 10.02 8.00 9.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.01 0.98 - 0.01 - - mov rax, rdi
+ - - 0.98 0.02 - - - - movabs rcx, 1537228672809129301
+ - - 0.02 0.98 - - - - cmp rsi, rcx
+ - - - - - 1.00 - - ja .LBB5_5
+ - - 0.98 - - 0.02 - - test rsi, rsi
+ - - - - - 1.00 - - je .LBB5_2
+ - - - - 1.00 - - 1.00 push r15
+ - - - - 1.00 - 1.00 - push r14
+ - - - - 1.00 - - 1.00 push rbx
+ - - - 1.00 - - - - lea rcx, [rsi + rsi]
+ - - - 1.00 - - - - lea rbx, [rcx + 2*rcx]
+ - - 1.00 - - - - - mov r14, rax
+ - - 1.00 - - - - - mov r15, rsi
+ - - - - 1.00 1.00 2.00 - call qword ptr [rip + __rustc::__rust_no_alloc_shim_is_unstable_v2@GOTPCREL]
+ - - - 0.01 - 0.99 - - mov esi, 2
+ - - 0.01 0.99 - - - - mov rdi, rbx
+ - - - - 1.00 1.00 - 2.00 call qword ptr [rip + __rustc::__rust_alloc_zeroed@GOTPCREL]
+ - - 0.01 - - 0.99 - - mov rsi, r15
+ - - 0.99 0.01 - - - - mov rcx, rax
+ - - - 0.99 - 0.01 - - mov rax, r14
+ - - 0.99 0.01 - - - - test rcx, rcx
+ - - - - - - - 1.00 pop rbx
+ - - - - - - 1.00 - pop r14
+ - - - - - - - 1.00 pop r15
+ - - - - - 1.00 - - je .LBB5_5
+ - - - - 1.00 - 1.00 - mov qword ptr [rax], rsi
+ - - - - 1.00 - - 1.00 mov qword ptr [rax + 8], rcx
+ - - - - 1.00 - 1.00 - mov qword ptr [rax + 16], rsi
+ - - - - - 1.00 - - ret
+ - - 0.01 0.99 - - - - movabs rcx, -9223372036854775808
+ - - - - 1.00 - - 1.00 mov qword ptr [rax], rcx
+ - - - - - 1.00 - - ret
+ - - 0.99 0.01 - - - - mov ecx, 2
+ - - - - 1.00 - 1.00 - mov qword ptr [rax], rsi
+ - - - - 1.00 - - 1.00 mov qword ptr [rax + 8], rcx
+ - - - - 1.00 - 1.00 - mov qword ptr [rax + 16], rsi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/new_zeroed.rs b/rust/zerocopy/benches/new_zeroed.rs
new file mode 100644
index 000000000..b49f62edb
--- /dev/null
+++ b/rust/zerocopy/benches/new_zeroed.rs
@@ -0,0 +1,9 @@
+use zerocopy::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_new_zeroed() -> format::LocoPacket {
+ FromZeros::new_zeroed()
+}
diff --git a/rust/zerocopy/benches/new_zeroed.x86-64 b/rust/zerocopy/benches/new_zeroed.x86-64
new file mode 100644
index 000000000..b4d305e41
--- /dev/null
+++ b/rust/zerocopy/benches/new_zeroed.x86-64
@@ -0,0 +1,3 @@
+bench_new_zeroed:
+ xor eax, eax
+ ret
diff --git a/rust/zerocopy/benches/new_zeroed.x86-64.mca b/rust/zerocopy/benches/new_zeroed.x86-64.mca
new file mode 100644
index 000000000..44583ca30
--- /dev/null
+++ b/rust/zerocopy/benches/new_zeroed.x86-64.mca
@@ -0,0 +1,43 @@
+Iterations: 100
+Instructions: 200
+Total Cycles: 103
+Total uOps: 200
+
+Dispatch Width: 4
+uOps Per Cycle: 1.94
+IPC: 1.94
+Block RThroughput: 1.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - - - - 1.00 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/read_from_bytes.rs b/rust/zerocopy/benches/read_from_bytes.rs
new file mode 100644
index 000000000..8a3baddad
--- /dev/null
+++ b/rust/zerocopy/benches/read_from_bytes.rs
@@ -0,0 +1,7 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_read_from_bytes_static_size(source: &[u8]) -> Option<format::LocoPacket> {
+ zerocopy::FromBytes::read_from_bytes(source).ok()
+}
diff --git a/rust/zerocopy/benches/read_from_bytes.x86-64 b/rust/zerocopy/benches/read_from_bytes.x86-64
new file mode 100644
index 000000000..9082d79f1
--- /dev/null
+++ b/rust/zerocopy/benches/read_from_bytes.x86-64
@@ -0,0 +1,15 @@
+bench_read_from_bytes_static_size:
+ mov rcx, rsi
+ cmp rsi, 6
+ jne .LBB5_2
+ mov eax, dword ptr [rdi]
+ movzx ecx, word ptr [rdi + 4]
+ shl rcx, 32
+ or rcx, rax
+.LBB5_2:
+ shl rcx, 16
+ inc rcx
+ xor eax, eax
+ cmp rsi, 6
+ cmove rax, rcx
+ ret
diff --git a/rust/zerocopy/benches/read_from_bytes.x86-64.mca b/rust/zerocopy/benches/read_from_bytes.x86-64.mca
new file mode 100644
index 000000000..77e787c19
--- /dev/null
+++ b/rust/zerocopy/benches/read_from_bytes.x86-64.mca
@@ -0,0 +1,65 @@
+Iterations: 100
+Instructions: 1300
+Total Cycles: 377
+Total uOps: 1400
+
+Dispatch Width: 4
+uOps Per Cycle: 3.71
+IPC: 3.45
+Block RThroughput: 3.5
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rcx, rsi
+ 1 1 0.33 cmp rsi, 6
+ 1 1 1.00 jne .LBB5_2
+ 1 5 0.50 * mov eax, dword ptr [rdi]
+ 1 5 0.50 * movzx ecx, word ptr [rdi + 4]
+ 1 1 0.50 shl rcx, 32
+ 1 1 0.33 or rcx, rax
+ 1 1 0.50 shl rcx, 16
+ 1 1 0.33 inc rcx
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp rsi, 6
+ 2 2 0.67 cmove rax, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 3.66 3.67 - 3.67 1.00 1.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.63 0.36 - 0.01 - - mov rcx, rsi
+ - - 0.05 0.05 - 0.90 - - cmp rsi, 6
+ - - - - - 1.00 - - jne .LBB5_2
+ - - - - - - - 1.00 mov eax, dword ptr [rdi]
+ - - - - - - 1.00 - movzx ecx, word ptr [rdi + 4]
+ - - 0.97 - - 0.03 - - shl rcx, 32
+ - - 0.02 0.35 - 0.63 - - or rcx, rax
+ - - 0.98 - - 0.02 - - shl rcx, 16
+ - - - 0.98 - 0.02 - - inc rcx
+ - - - - - - - - xor eax, eax
+ - - 0.03 0.93 - 0.04 - - cmp rsi, 6
+ - - 0.98 1.00 - 0.02 - - cmove rax, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/read_from_prefix.rs b/rust/zerocopy/benches/read_from_prefix.rs
new file mode 100644
index 000000000..d49bf80ab
--- /dev/null
+++ b/rust/zerocopy/benches/read_from_prefix.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_read_from_prefix_static_size(source: &[u8]) -> Option<format::LocoPacket> {
+ match zerocopy::FromBytes::read_from_prefix(source) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/read_from_prefix.x86-64 b/rust/zerocopy/benches/read_from_prefix.x86-64
new file mode 100644
index 000000000..c75b06c0c
--- /dev/null
+++ b/rust/zerocopy/benches/read_from_prefix.x86-64
@@ -0,0 +1,14 @@
+bench_read_from_prefix_static_size:
+ cmp rsi, 5
+ jbe .LBB5_2
+ mov eax, dword ptr [rdi]
+ movzx edi, word ptr [rdi + 4]
+ shl rdi, 32
+ or rdi, rax
+.LBB5_2:
+ shl rdi, 16
+ inc rdi
+ xor eax, eax
+ cmp rsi, 6
+ cmovae rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/read_from_prefix.x86-64.mca b/rust/zerocopy/benches/read_from_prefix.x86-64.mca
new file mode 100644
index 000000000..04e76cdd0
--- /dev/null
+++ b/rust/zerocopy/benches/read_from_prefix.x86-64.mca
@@ -0,0 +1,63 @@
+Iterations: 100
+Instructions: 1200
+Total Cycles: 905
+Total uOps: 1300
+
+Dispatch Width: 4
+uOps Per Cycle: 1.44
+IPC: 1.33
+Block RThroughput: 3.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 cmp rsi, 5
+ 1 1 1.00 jbe .LBB5_2
+ 1 5 0.50 * mov eax, dword ptr [rdi]
+ 1 5 0.50 * movzx edi, word ptr [rdi + 4]
+ 1 1 0.50 shl rdi, 32
+ 1 1 0.33 or rdi, rax
+ 1 1 0.50 shl rdi, 16
+ 1 1 0.33 inc rdi
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp rsi, 6
+ 2 2 0.67 cmovae rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 3.32 3.32 - 3.36 1.00 1.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.05 0.94 - 0.01 - - cmp rsi, 5
+ - - - - - 1.00 - - jbe .LBB5_2
+ - - - - - - - 1.00 mov eax, dword ptr [rdi]
+ - - - - - - 1.00 - movzx edi, word ptr [rdi + 4]
+ - - 0.71 - - 0.29 - - shl rdi, 32
+ - - - 0.64 - 0.36 - - or rdi, rax
+ - - 1.00 - - - - - shl rdi, 16
+ - - 0.31 0.40 - 0.29 - - inc rdi
+ - - - - - - - - xor eax, eax
+ - - 0.34 0.35 - 0.31 - - cmp rsi, 6
+ - - 0.91 0.99 - 0.10 - - cmovae rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/read_from_suffix.rs b/rust/zerocopy/benches/read_from_suffix.rs
new file mode 100644
index 000000000..4eaadb0d4
--- /dev/null
+++ b/rust/zerocopy/benches/read_from_suffix.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_read_from_suffix_static_size(source: &[u8]) -> Option<format::LocoPacket> {
+ match zerocopy::FromBytes::read_from_suffix(source) {
+ Ok((_rest, packet)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/read_from_suffix.x86-64 b/rust/zerocopy/benches/read_from_suffix.x86-64
new file mode 100644
index 000000000..5cff2a0e2
--- /dev/null
+++ b/rust/zerocopy/benches/read_from_suffix.x86-64
@@ -0,0 +1,15 @@
+bench_read_from_suffix_static_size:
+ mov rcx, rsi
+ cmp rsi, 6
+ jb .LBB5_2
+ mov eax, dword ptr [rdi + rsi - 6]
+ movzx ecx, word ptr [rdi + rsi - 2]
+ shl rcx, 32
+ or rcx, rax
+.LBB5_2:
+ shl rcx, 16
+ inc rcx
+ xor eax, eax
+ cmp rsi, 6
+ cmovae rax, rcx
+ ret
diff --git a/rust/zerocopy/benches/read_from_suffix.x86-64.mca b/rust/zerocopy/benches/read_from_suffix.x86-64.mca
new file mode 100644
index 000000000..0107de895
--- /dev/null
+++ b/rust/zerocopy/benches/read_from_suffix.x86-64.mca
@@ -0,0 +1,65 @@
+Iterations: 100
+Instructions: 1300
+Total Cycles: 377
+Total uOps: 1400
+
+Dispatch Width: 4
+uOps Per Cycle: 3.71
+IPC: 3.45
+Block RThroughput: 3.5
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rcx, rsi
+ 1 1 0.33 cmp rsi, 6
+ 1 1 1.00 jb .LBB5_2
+ 1 5 0.50 * mov eax, dword ptr [rdi + rsi - 6]
+ 1 5 0.50 * movzx ecx, word ptr [rdi + rsi - 2]
+ 1 1 0.50 shl rcx, 32
+ 1 1 0.33 or rcx, rax
+ 1 1 0.50 shl rcx, 16
+ 1 1 0.33 inc rcx
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp rsi, 6
+ 2 2 0.67 cmovae rax, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 3.66 3.67 - 3.67 1.00 1.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.63 0.36 - 0.01 - - mov rcx, rsi
+ - - 0.05 0.05 - 0.90 - - cmp rsi, 6
+ - - - - - 1.00 - - jb .LBB5_2
+ - - - - - - - 1.00 mov eax, dword ptr [rdi + rsi - 6]
+ - - - - - - 1.00 - movzx ecx, word ptr [rdi + rsi - 2]
+ - - 0.97 - - 0.03 - - shl rcx, 32
+ - - 0.02 0.35 - 0.63 - - or rcx, rax
+ - - 0.98 - - 0.02 - - shl rcx, 16
+ - - - 0.98 - 0.02 - - inc rcx
+ - - - - - - - - xor eax, eax
+ - - 0.03 0.93 - 0.04 - - cmp rsi, 6
+ - - 0.98 1.00 - 0.02 - - cmovae rax, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_bytes_dynamic_padding.rs b/rust/zerocopy/benches/ref_from_bytes_dynamic_padding.rs
new file mode 100644
index 000000000..29708df55
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_dynamic_padding.rs
@@ -0,0 +1,7 @@
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_bytes_dynamic_padding(source: &[u8]) -> Option<&format::LocoPacket> {
+ zerocopy::FromBytes::ref_from_bytes(source).ok()
+}
diff --git a/rust/zerocopy/benches/ref_from_bytes_dynamic_padding.x86-64 b/rust/zerocopy/benches/ref_from_bytes_dynamic_padding.x86-64
new file mode 100644
index 000000000..e844a4608
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_dynamic_padding.x86-64
@@ -0,0 +1,22 @@
+bench_ref_from_bytes_dynamic_padding:
+ test dil, 3
+ jne .LBB5_3
+ movabs rax, 9223372036854775804
+ and rax, rsi
+ cmp rax, 9
+ jb .LBB5_3
+ add rax, -9
+ movabs rcx, -6148914691236517205
+ mul rcx
+ shr rdx
+ lea rax, [rdx + 2*rdx]
+ or rax, 3
+ add rax, 9
+ cmp rsi, rax
+ je .LBB5_4
+.LBB5_3:
+ xor edi, edi
+ mov rdx, rsi
+.LBB5_4:
+ mov rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/ref_from_bytes_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/ref_from_bytes_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..423ed38ba
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_dynamic_padding.x86-64.mca
@@ -0,0 +1,77 @@
+Iterations: 100
+Instructions: 1900
+Total Cycles: 645
+Total uOps: 2000
+
+Dispatch Width: 4
+uOps Per Cycle: 3.10
+IPC: 2.95
+Block RThroughput: 5.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 test dil, 3
+ 1 1 1.00 jne .LBB5_3
+ 1 1 0.33 movabs rax, 9223372036854775804
+ 1 1 0.33 and rax, rsi
+ 1 1 0.33 cmp rax, 9
+ 1 1 1.00 jb .LBB5_3
+ 1 1 0.33 add rax, -9
+ 1 1 0.33 movabs rcx, -6148914691236517205
+ 2 4 1.00 mul rcx
+ 1 1 0.50 shr rdx
+ 1 1 0.50 lea rax, [rdx + 2*rdx]
+ 1 1 0.33 or rax, 3
+ 1 1 0.33 add rax, 9
+ 1 1 0.33 cmp rsi, rax
+ 1 1 1.00 je .LBB5_4
+ 1 0 0.25 xor edi, edi
+ 1 1 0.33 mov rdx, rsi
+ 1 1 0.33 mov rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 6.32 6.33 - 6.35 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.64 0.35 - 0.01 - - test dil, 3
+ - - - - - 1.00 - - jne .LBB5_3
+ - - 0.34 0.65 - 0.01 - - movabs rax, 9223372036854775804
+ - - 0.35 0.65 - - - - and rax, rsi
+ - - 0.33 0.34 - 0.33 - - cmp rax, 9
+ - - - - - 1.00 - - jb .LBB5_3
+ - - 0.35 - - 0.65 - - add rax, -9
+ - - 0.97 0.01 - 0.02 - - movabs rcx, -6148914691236517205
+ - - 1.00 1.00 - - - - mul rcx
+ - - 0.99 - - 0.01 - - shr rdx
+ - - 0.33 0.67 - - - - lea rax, [rdx + 2*rdx]
+ - - 0.34 0.66 - - - - or rax, 3
+ - - 0.33 0.66 - 0.01 - - add rax, 9
+ - - 0.01 0.99 - - - - cmp rsi, rax
+ - - - - - 1.00 - - je .LBB5_4
+ - - - - - - - - xor edi, edi
+ - - 0.32 0.01 - 0.67 - - mov rdx, rsi
+ - - 0.02 0.34 - 0.64 - - mov rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_bytes_dynamic_size.rs b/rust/zerocopy/benches/ref_from_bytes_dynamic_size.rs
new file mode 100644
index 000000000..4eb4f970e
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_dynamic_size.rs
@@ -0,0 +1,7 @@
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_bytes_dynamic_size(source: &[u8]) -> Option<&format::LocoPacket> {
+ zerocopy::FromBytes::ref_from_bytes(source).ok()
+}
diff --git a/rust/zerocopy/benches/ref_from_bytes_dynamic_size.x86-64 b/rust/zerocopy/benches/ref_from_bytes_dynamic_size.x86-64
new file mode 100644
index 000000000..cc905b76c
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_dynamic_size.x86-64
@@ -0,0 +1,20 @@
+bench_ref_from_bytes_dynamic_size:
+ mov rdx, rsi
+ cmp rsi, 4
+ setb al
+ or al, dil
+ test al, 1
+ je .LBB5_2
+ xor eax, eax
+ ret
+.LBB5_2:
+ lea rcx, [rdx - 4]
+ mov rsi, rcx
+ and rsi, -2
+ add rsi, 4
+ shr rcx
+ xor eax, eax
+ cmp rdx, rsi
+ cmove rdx, rcx
+ cmove rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/ref_from_bytes_dynamic_size.x86-64.mca b/rust/zerocopy/benches/ref_from_bytes_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..68aea583e
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_dynamic_size.x86-64.mca
@@ -0,0 +1,75 @@
+Iterations: 100
+Instructions: 1800
+Total Cycles: 704
+Total uOps: 2000
+
+Dispatch Width: 4
+uOps Per Cycle: 2.84
+IPC: 2.56
+Block RThroughput: 5.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rdx, rsi
+ 1 1 0.33 cmp rsi, 4
+ 1 1 0.50 setb al
+ 1 1 0.33 or al, dil
+ 1 1 0.33 test al, 1
+ 1 1 1.00 je .LBB5_2
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+ 1 1 0.50 lea rcx, [rdx - 4]
+ 1 1 0.33 mov rsi, rcx
+ 1 1 0.33 and rsi, -2
+ 1 1 0.33 add rsi, 4
+ 1 1 0.50 shr rcx
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp rdx, rsi
+ 2 2 0.67 cmove rdx, rcx
+ 2 2 0.67 cmove rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 5.97 5.98 - 6.05 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.97 0.01 - 0.02 - - mov rdx, rsi
+ - - 0.01 0.02 - 0.97 - - cmp rsi, 4
+ - - 0.03 - - 0.97 - - setb al
+ - - 0.01 0.02 - 0.97 - - or al, dil
+ - - - 0.98 - 0.02 - - test al, 1
+ - - - - - 1.00 - - je .LBB5_2
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
+ - - 0.98 0.02 - - - - lea rcx, [rdx - 4]
+ - - 0.01 0.99 - - - - mov rsi, rcx
+ - - - 0.98 - 0.02 - - and rsi, -2
+ - - 0.98 0.01 - 0.01 - - add rsi, 4
+ - - 0.99 - - 0.01 - - shr rcx
+ - - - - - - - - xor eax, eax
+ - - 0.02 0.97 - 0.01 - - cmp rdx, rsi
+ - - 0.99 0.99 - 0.02 - - cmove rdx, rcx
+ - - 0.98 0.99 - 0.03 - - cmove rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_bytes_static_size.rs b/rust/zerocopy/benches/ref_from_bytes_static_size.rs
new file mode 100644
index 000000000..3742bba07
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_static_size.rs
@@ -0,0 +1,7 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_bytes_static_size(source: &[u8]) -> Option<&format::LocoPacket> {
+ zerocopy::FromBytes::ref_from_bytes(source).ok()
+}
diff --git a/rust/zerocopy/benches/ref_from_bytes_static_size.x86-64 b/rust/zerocopy/benches/ref_from_bytes_static_size.x86-64
new file mode 100644
index 000000000..2c8da68c8
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_static_size.x86-64
@@ -0,0 +1,8 @@
+bench_ref_from_bytes_static_size:
+ mov ecx, edi
+ and ecx, 1
+ xor rsi, 6
+ xor eax, eax
+ or rsi, rcx
+ cmove rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/ref_from_bytes_static_size.x86-64.mca b/rust/zerocopy/benches/ref_from_bytes_static_size.x86-64.mca
new file mode 100644
index 000000000..832697801
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_static_size.x86-64.mca
@@ -0,0 +1,53 @@
+Iterations: 100
+Instructions: 700
+Total Cycles: 240
+Total uOps: 800
+
+Dispatch Width: 4
+uOps Per Cycle: 3.33
+IPC: 2.92
+Block RThroughput: 2.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov ecx, edi
+ 1 1 0.33 and ecx, 1
+ 1 1 0.33 xor rsi, 6
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 or rsi, rcx
+ 2 2 0.67 cmove rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 2.33 2.33 - 2.34 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.01 0.98 - 0.01 - - mov ecx, edi
+ - - 0.02 0.66 - 0.32 - - and ecx, 1
+ - - 0.33 0.66 - 0.01 - - xor rsi, 6
+ - - - - - - - - xor eax, eax
+ - - 0.98 0.02 - - - - or rsi, rcx
+ - - 0.99 0.01 - 1.00 - - cmove rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_padding.rs b/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_padding.rs
new file mode 100644
index 000000000..b4fea4aee
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_padding.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_bytes_with_elems_dynamic_padding(
+ source: &[u8],
+ count: usize,
+) -> Option<&format::LocoPacket> {
+ zerocopy::FromBytes::ref_from_bytes_with_elems(source, count).ok()
+}
diff --git a/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_padding.x86-64 b/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_padding.x86-64
new file mode 100644
index 000000000..d579b3fae
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_padding.x86-64
@@ -0,0 +1,19 @@
+bench_ref_from_bytes_with_elems_dynamic_padding:
+ movabs rax, 3074457345618258598
+ cmp rdx, rax
+ seta cl
+ mov rax, rdi
+ test al, 3
+ setne dil
+ or dil, cl
+ jne .LBB5_2
+ lea rcx, [rdx + 2*rdx]
+ or rcx, 3
+ add rcx, 9
+ cmp rsi, rcx
+ je .LBB5_3
+.LBB5_2:
+ xor eax, eax
+ mov rdx, rsi
+.LBB5_3:
+ ret
diff --git a/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..ea2d83dbd
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_padding.x86-64.mca
@@ -0,0 +1,71 @@
+Iterations: 100
+Instructions: 1600
+Total Cycles: 539
+Total uOps: 1700
+
+Dispatch Width: 4
+uOps Per Cycle: 3.15
+IPC: 2.97
+Block RThroughput: 4.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movabs rax, 3074457345618258598
+ 1 1 0.33 cmp rdx, rax
+ 2 2 1.00 seta cl
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 test al, 3
+ 1 1 0.50 setne dil
+ 1 1 0.33 or dil, cl
+ 1 1 1.00 jne .LBB5_2
+ 1 1 0.50 lea rcx, [rdx + 2*rdx]
+ 1 1 0.33 or rcx, 3
+ 1 1 0.33 add rcx, 9
+ 1 1 0.33 cmp rsi, rcx
+ 1 1 1.00 je .LBB5_3
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 mov rdx, rsi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 5.33 5.32 - 5.35 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.01 0.98 - 0.01 - - movabs rax, 3074457345618258598
+ - - - 1.00 - - - - cmp rdx, rax
+ - - 1.98 - - 0.02 - - seta cl
+ - - 0.02 0.98 - - - - mov rax, rdi
+ - - - 0.67 - 0.33 - - test al, 3
+ - - 0.67 - - 0.33 - - setne dil
+ - - 0.99 - - 0.01 - - or dil, cl
+ - - - - - 1.00 - - jne .LBB5_2
+ - - 0.01 0.99 - - - - lea rcx, [rdx + 2*rdx]
+ - - - 0.01 - 0.99 - - or rcx, 3
+ - - 0.65 0.02 - 0.33 - - add rcx, 9
+ - - 0.99 0.01 - - - - cmp rsi, rcx
+ - - - - - 1.00 - - je .LBB5_3
+ - - - - - - - - xor eax, eax
+ - - 0.01 0.66 - 0.33 - - mov rdx, rsi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_size.rs b/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_size.rs
new file mode 100644
index 000000000..9d33a7c31
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_size.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_bytes_with_elems_dynamic_size(
+ source: &[u8],
+ count: usize,
+) -> Option<&format::LocoPacket> {
+ zerocopy::FromBytes::ref_from_bytes_with_elems(source, count).ok()
+}
diff --git a/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_size.x86-64 b/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_size.x86-64
new file mode 100644
index 000000000..3d8d15b7f
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_size.x86-64
@@ -0,0 +1,16 @@
+bench_ref_from_bytes_with_elems_dynamic_size:
+ movabs rax, 4611686018427387901
+ cmp rdx, rax
+ seta cl
+ mov rax, rdi
+ or dil, cl
+ test dil, 1
+ jne .LBB5_2
+ lea rcx, [2*rdx + 4]
+ cmp rsi, rcx
+ je .LBB5_3
+.LBB5_2:
+ xor eax, eax
+ mov rdx, rsi
+.LBB5_3:
+ ret
diff --git a/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_size.x86-64.mca b/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..602179f3c
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_bytes_with_elems_dynamic_size.x86-64.mca
@@ -0,0 +1,65 @@
+Iterations: 100
+Instructions: 1300
+Total Cycles: 439
+Total uOps: 1400
+
+Dispatch Width: 4
+uOps Per Cycle: 3.19
+IPC: 2.96
+Block RThroughput: 3.5
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movabs rax, 4611686018427387901
+ 1 1 0.33 cmp rdx, rax
+ 2 2 1.00 seta cl
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 or dil, cl
+ 1 1 0.33 test dil, 1
+ 1 1 1.00 jne .LBB5_2
+ 1 1 0.50 lea rcx, [2*rdx + 4]
+ 1 1 0.33 cmp rsi, rcx
+ 1 1 1.00 je .LBB5_3
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 mov rdx, rsi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 4.32 4.33 - 4.35 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - 0.99 - 0.01 - - movabs rax, 4611686018427387901
+ - - 0.33 0.67 - - - - cmp rdx, rax
+ - - 1.98 - - 0.02 - - seta cl
+ - - 0.01 0.99 - - - - mov rax, rdi
+ - - 1.00 - - - - - or dil, cl
+ - - 0.99 0.01 - - - - test dil, 1
+ - - - - - 1.00 - - jne .LBB5_2
+ - - - 1.00 - - - - lea rcx, [2*rdx + 4]
+ - - 0.01 - - 0.99 - - cmp rsi, rcx
+ - - - - - 1.00 - - je .LBB5_3
+ - - - - - - - - xor eax, eax
+ - - - 0.67 - 0.33 - - mov rdx, rsi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_prefix_dynamic_padding.rs b/rust/zerocopy/benches/ref_from_prefix_dynamic_padding.rs
new file mode 100644
index 000000000..53c707b88
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_dynamic_padding.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_prefix_dynamic_padding(source: &[u8]) -> Option<&format::LocoPacket> {
+ match zerocopy::FromBytes::ref_from_prefix(source) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/ref_from_prefix_dynamic_padding.x86-64 b/rust/zerocopy/benches/ref_from_prefix_dynamic_padding.x86-64
new file mode 100644
index 000000000..a58592a24
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_dynamic_padding.x86-64
@@ -0,0 +1,22 @@
+bench_ref_from_prefix_dynamic_padding:
+ xor edx, edx
+ mov eax, 0
+ test dil, 3
+ je .LBB5_1
+ ret
+.LBB5_1:
+ movabs rax, 9223372036854775804
+ and rsi, rax
+ cmp rsi, 9
+ jae .LBB5_3
+ mov edx, 1
+ xor eax, eax
+ ret
+.LBB5_3:
+ add rsi, -9
+ movabs rcx, -6148914691236517205
+ mov rax, rsi
+ mul rcx
+ shr rdx
+ mov rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/ref_from_prefix_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/ref_from_prefix_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..62ea4baba
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_dynamic_padding.x86-64.mca
@@ -0,0 +1,77 @@
+Iterations: 100
+Instructions: 1900
+Total Cycles: 608
+Total uOps: 2000
+
+Dispatch Width: 4
+uOps Per Cycle: 3.29
+IPC: 3.13
+Block RThroughput: 5.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 0 0.25 xor edx, edx
+ 1 1 0.33 mov eax, 0
+ 1 1 0.33 test dil, 3
+ 1 1 1.00 je .LBB5_1
+ 1 1 1.00 U ret
+ 1 1 0.33 movabs rax, 9223372036854775804
+ 1 1 0.33 and rsi, rax
+ 1 1 0.33 cmp rsi, 9
+ 1 1 1.00 jae .LBB5_3
+ 1 1 0.33 mov edx, 1
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+ 1 1 0.33 add rsi, -9
+ 1 1 0.33 movabs rcx, -6148914691236517205
+ 1 1 0.33 mov rax, rsi
+ 2 4 1.00 mul rcx
+ 1 1 0.50 shr rdx
+ 1 1 0.33 mov rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 6.00 6.00 - 6.00 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - - - - - xor edx, edx
+ - - 0.01 0.98 - 0.01 - - mov eax, 0
+ - - 0.98 0.01 - 0.01 - - test dil, 3
+ - - - - - 1.00 - - je .LBB5_1
+ - - - - - 1.00 - - ret
+ - - 0.01 0.99 - - - - movabs rax, 9223372036854775804
+ - - - 1.00 - - - - and rsi, rax
+ - - - 1.00 - - - - cmp rsi, 9
+ - - - - - 1.00 - - jae .LBB5_3
+ - - 1.00 - - - - - mov edx, 1
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
+ - - 0.02 0.02 - 0.96 - - add rsi, -9
+ - - 0.99 0.01 - - - - movabs rcx, -6148914691236517205
+ - - 0.01 0.99 - - - - mov rax, rsi
+ - - 1.00 1.00 - - - - mul rcx
+ - - 1.00 - - - - - shr rdx
+ - - 0.98 - - 0.02 - - mov rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_prefix_dynamic_size.rs b/rust/zerocopy/benches/ref_from_prefix_dynamic_size.rs
new file mode 100644
index 000000000..a3f26f6b4
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_dynamic_size.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_prefix_dynamic_size(source: &[u8]) -> Option<&format::LocoPacket> {
+ match zerocopy::FromBytes::ref_from_prefix(source) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/ref_from_prefix_dynamic_size.x86-64 b/rust/zerocopy/benches/ref_from_prefix_dynamic_size.x86-64
new file mode 100644
index 000000000..fe6332c91
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_dynamic_size.x86-64
@@ -0,0 +1,17 @@
+bench_ref_from_prefix_dynamic_size:
+ xor edx, edx
+ mov eax, 0
+ test dil, 1
+ jne .LBB5_4
+ cmp rsi, 4
+ jae .LBB5_3
+ mov edx, 1
+ xor eax, eax
+ ret
+.LBB5_3:
+ add rsi, -4
+ shr rsi
+ mov rdx, rsi
+ mov rax, rdi
+.LBB5_4:
+ ret
diff --git a/rust/zerocopy/benches/ref_from_prefix_dynamic_size.x86-64.mca b/rust/zerocopy/benches/ref_from_prefix_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..3900a5946
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_dynamic_size.x86-64.mca
@@ -0,0 +1,67 @@
+Iterations: 100
+Instructions: 1400
+Total Cycles: 405
+Total uOps: 1400
+
+Dispatch Width: 4
+uOps Per Cycle: 3.46
+IPC: 3.46
+Block RThroughput: 4.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 0 0.25 xor edx, edx
+ 1 1 0.33 mov eax, 0
+ 1 1 0.33 test dil, 1
+ 1 1 1.00 jne .LBB5_4
+ 1 1 0.33 cmp rsi, 4
+ 1 1 1.00 jae .LBB5_3
+ 1 1 0.33 mov edx, 1
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+ 1 1 0.33 add rsi, -4
+ 1 1 0.50 shr rsi
+ 1 1 0.33 mov rdx, rsi
+ 1 1 0.33 mov rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 3.99 3.99 - 4.02 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - - - - - xor edx, edx
+ - - 0.01 0.98 - 0.01 - - mov eax, 0
+ - - 0.98 0.02 - - - - test dil, 1
+ - - - - - 1.00 - - jne .LBB5_4
+ - - 0.02 0.98 - - - - cmp rsi, 4
+ - - - - - 1.00 - - jae .LBB5_3
+ - - 0.98 0.01 - 0.01 - - mov edx, 1
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
+ - - 0.01 0.99 - - - - add rsi, -4
+ - - 1.00 - - - - - shr rsi
+ - - - 1.00 - - - - mov rdx, rsi
+ - - 0.99 0.01 - - - - mov rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_prefix_static_size.rs b/rust/zerocopy/benches/ref_from_prefix_static_size.rs
new file mode 100644
index 000000000..834fa3928
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_static_size.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_prefix_static_size(source: &[u8]) -> Option<&format::LocoPacket> {
+ match zerocopy::FromBytes::ref_from_prefix(source) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/ref_from_prefix_static_size.x86-64 b/rust/zerocopy/benches/ref_from_prefix_static_size.x86-64
new file mode 100644
index 000000000..7c1bf45bb
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_static_size.x86-64
@@ -0,0 +1,8 @@
+bench_ref_from_prefix_static_size:
+ xor eax, eax
+ cmp rsi, 6
+ mov rcx, rdi
+ cmovb rcx, rax
+ test dil, 1
+ cmove rax, rcx
+ ret
diff --git a/rust/zerocopy/benches/ref_from_prefix_static_size.x86-64.mca b/rust/zerocopy/benches/ref_from_prefix_static_size.x86-64.mca
new file mode 100644
index 000000000..9691b88fe
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_static_size.x86-64.mca
@@ -0,0 +1,53 @@
+Iterations: 100
+Instructions: 700
+Total Cycles: 274
+Total uOps: 900
+
+Dispatch Width: 4
+uOps Per Cycle: 3.28
+IPC: 2.55
+Block RThroughput: 2.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp rsi, 6
+ 1 1 0.33 mov rcx, rdi
+ 2 2 0.67 cmovb rcx, rax
+ 1 1 0.33 test dil, 1
+ 2 2 0.67 cmove rax, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 2.66 2.67 - 2.67 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - - - - - xor eax, eax
+ - - - 0.01 - 0.99 - - cmp rsi, 6
+ - - 0.01 0.67 - 0.32 - - mov rcx, rdi
+ - - 1.00 0.99 - 0.01 - - cmovb rcx, rax
+ - - 0.66 0.01 - 0.33 - - test dil, 1
+ - - 0.99 0.99 - 0.02 - - cmove rax, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_padding.rs b/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_padding.rs
new file mode 100644
index 000000000..55d495e00
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_padding.rs
@@ -0,0 +1,13 @@
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_prefix_with_elems_dynamic_padding(
+ source: &[u8],
+ count: usize,
+) -> Option<&format::LocoPacket> {
+ match zerocopy::FromBytes::ref_from_prefix_with_elems(source, count) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_padding.x86-64 b/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_padding.x86-64
new file mode 100644
index 000000000..5b31277bd
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_padding.x86-64
@@ -0,0 +1,26 @@
+bench_ref_from_prefix_with_elems_dynamic_padding:
+ movabs rax, 3074457345618258598
+ cmp rdx, rax
+ ja .LBB5_1
+ xor ecx, ecx
+ mov eax, 0
+ test dil, 3
+ je .LBB5_3
+ mov rdx, rcx
+ ret
+.LBB5_1:
+ mov edx, 1
+ xor eax, eax
+ ret
+.LBB5_3:
+ lea rax, [rdx + 2*rdx]
+ or rax, 3
+ add rax, 9
+ xor r8d, r8d
+ cmp rax, rsi
+ mov ecx, 1
+ cmovbe rcx, rdx
+ cmova rdi, r8
+ mov rax, rdi
+ mov rdx, rcx
+ ret
diff --git a/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..2f212ec6d
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_padding.x86-64.mca
@@ -0,0 +1,85 @@
+Iterations: 100
+Instructions: 2300
+Total Cycles: 807
+Total uOps: 2700
+
+Dispatch Width: 4
+uOps Per Cycle: 3.35
+IPC: 2.85
+Block RThroughput: 6.8
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movabs rax, 3074457345618258598
+ 1 1 0.33 cmp rdx, rax
+ 1 1 1.00 ja .LBB5_1
+ 1 0 0.25 xor ecx, ecx
+ 1 1 0.33 mov eax, 0
+ 1 1 0.33 test dil, 3
+ 1 1 1.00 je .LBB5_3
+ 1 1 0.33 mov rdx, rcx
+ 1 1 1.00 U ret
+ 1 1 0.33 mov edx, 1
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+ 1 1 0.50 lea rax, [rdx + 2*rdx]
+ 1 1 0.33 or rax, 3
+ 1 1 0.33 add rax, 9
+ 1 0 0.25 xor r8d, r8d
+ 1 1 0.33 cmp rax, rsi
+ 1 1 0.33 mov ecx, 1
+ 3 3 1.00 cmovbe rcx, rdx
+ 3 3 1.00 cmova rdi, r8
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 mov rdx, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 7.99 7.99 - 8.02 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.47 0.52 - 0.01 - - movabs rax, 3074457345618258598
+ - - 0.94 0.01 - 0.05 - - cmp rdx, rax
+ - - - - - 1.00 - - ja .LBB5_1
+ - - - - - - - - xor ecx, ecx
+ - - 0.03 0.97 - - - - mov eax, 0
+ - - 0.01 0.52 - 0.47 - - test dil, 3
+ - - - - - 1.00 - - je .LBB5_3
+ - - 0.03 0.51 - 0.46 - - mov rdx, rcx
+ - - - - - 1.00 - - ret
+ - - 0.04 0.96 - - - - mov edx, 1
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
+ - - 0.01 0.99 - - - - lea rax, [rdx + 2*rdx]
+ - - 0.52 0.48 - - - - or rax, 3
+ - - 0.51 0.49 - - - - add rax, 9
+ - - - - - - - - xor r8d, r8d
+ - - 0.97 0.03 - - - - cmp rax, rsi
+ - - 0.01 0.99 - - - - mov ecx, 1
+ - - 1.04 0.97 - 0.99 - - cmovbe rcx, rdx
+ - - 1.44 0.54 - 1.02 - - cmova rdi, r8
+ - - 0.97 0.01 - 0.02 - - mov rax, rdi
+ - - 1.00 - - - - - mov rdx, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_size.rs b/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_size.rs
new file mode 100644
index 000000000..e9663c721
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_size.rs
@@ -0,0 +1,13 @@
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_prefix_with_elems_dynamic_size(
+ source: &[u8],
+ count: usize,
+) -> Option<&format::LocoPacket> {
+ match zerocopy::FromBytes::ref_from_prefix_with_elems(source, count) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_size.x86-64 b/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_size.x86-64
new file mode 100644
index 000000000..069fd4859
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_size.x86-64
@@ -0,0 +1,22 @@
+bench_ref_from_prefix_with_elems_dynamic_size:
+ movabs rax, 4611686018427387901
+ cmp rdx, rax
+ ja .LBB5_1
+ mov rcx, rdx
+ xor edx, edx
+ mov eax, 0
+ test dil, 1
+ jne .LBB5_4
+ lea rax, [2*rcx + 4]
+ xor r8d, r8d
+ cmp rax, rsi
+ mov edx, 1
+ cmovbe rdx, rcx
+ cmova rdi, r8
+ mov rax, rdi
+.LBB5_4:
+ ret
+.LBB5_1:
+ mov edx, 1
+ xor eax, eax
+ ret
diff --git a/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_size.x86-64.mca b/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..6f2272640
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_prefix_with_elems_dynamic_size.x86-64.mca
@@ -0,0 +1,77 @@
+Iterations: 100
+Instructions: 1900
+Total Cycles: 672
+Total uOps: 2300
+
+Dispatch Width: 4
+uOps Per Cycle: 3.42
+IPC: 2.83
+Block RThroughput: 5.8
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movabs rax, 4611686018427387901
+ 1 1 0.33 cmp rdx, rax
+ 1 1 1.00 ja .LBB5_1
+ 1 1 0.33 mov rcx, rdx
+ 1 0 0.25 xor edx, edx
+ 1 1 0.33 mov eax, 0
+ 1 1 0.33 test dil, 1
+ 1 1 1.00 jne .LBB5_4
+ 1 1 0.50 lea rax, [2*rcx + 4]
+ 1 0 0.25 xor r8d, r8d
+ 1 1 0.33 cmp rax, rsi
+ 1 1 0.33 mov edx, 1
+ 3 3 1.00 cmovbe rdx, rcx
+ 3 3 1.00 cmova rdi, r8
+ 1 1 0.33 mov rax, rdi
+ 1 1 1.00 U ret
+ 1 1 0.33 mov edx, 1
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 6.66 6.66 - 6.68 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - 0.99 - 0.01 - - movabs rax, 4611686018427387901
+ - - 0.37 0.63 - - - - cmp rdx, rax
+ - - - - - 1.00 - - ja .LBB5_1
+ - - 0.63 0.37 - - - - mov rcx, rdx
+ - - - - - - - - xor edx, edx
+ - - 0.01 0.98 - 0.01 - - mov eax, 0
+ - - 0.98 0.02 - - - - test dil, 1
+ - - - - - 1.00 - - jne .LBB5_4
+ - - 0.01 0.99 - - - - lea rax, [2*rcx + 4]
+ - - - - - - - - xor r8d, r8d
+ - - 1.00 - - - - - cmp rax, rsi
+ - - - 0.67 - 0.33 - - mov edx, 1
+ - - 0.73 0.98 - 1.29 - - cmovbe rdx, rcx
+ - - 1.60 0.36 - 1.04 - - cmova rdi, r8
+ - - 0.99 0.01 - - - - mov rax, rdi
+ - - - - - 1.00 - - ret
+ - - 0.34 0.66 - - - - mov edx, 1
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_suffix_dynamic_padding.rs b/rust/zerocopy/benches/ref_from_suffix_dynamic_padding.rs
new file mode 100644
index 000000000..5a6ea3a33
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_dynamic_padding.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_suffix_dynamic_padding(source: &[u8]) -> Option<&format::LocoPacket> {
+ match zerocopy::FromBytes::ref_from_suffix(source) {
+ Ok((_rest, packet)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/ref_from_suffix_dynamic_padding.x86-64 b/rust/zerocopy/benches/ref_from_suffix_dynamic_padding.x86-64
new file mode 100644
index 000000000..3e05f6023
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_dynamic_padding.x86-64
@@ -0,0 +1,23 @@
+bench_ref_from_suffix_dynamic_padding:
+ lea eax, [rsi + rdi]
+ test al, 3
+ jne .LBB5_1
+ movabs rax, 9223372036854775804
+ and rax, rsi
+ cmp rax, 9
+ jae .LBB5_3
+.LBB5_1:
+ xor eax, eax
+ ret
+.LBB5_3:
+ add rax, -9
+ movabs rcx, -6148914691236517205
+ mul rcx
+ shr rdx
+ lea rax, [rdx + 2*rdx]
+ sub rsi, rax
+ or rax, -4
+ add rsi, rdi
+ add rax, rsi
+ add rax, -8
+ ret
diff --git a/rust/zerocopy/benches/ref_from_suffix_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/ref_from_suffix_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..73599d5b6
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_dynamic_padding.x86-64.mca
@@ -0,0 +1,79 @@
+Iterations: 100
+Instructions: 2000
+Total Cycles: 682
+Total uOps: 2100
+
+Dispatch Width: 4
+uOps Per Cycle: 3.08
+IPC: 2.93
+Block RThroughput: 5.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.50 lea eax, [rsi + rdi]
+ 1 1 0.33 test al, 3
+ 1 1 1.00 jne .LBB5_1
+ 1 1 0.33 movabs rax, 9223372036854775804
+ 1 1 0.33 and rax, rsi
+ 1 1 0.33 cmp rax, 9
+ 1 1 1.00 jae .LBB5_3
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+ 1 1 0.33 add rax, -9
+ 1 1 0.33 movabs rcx, -6148914691236517205
+ 2 4 1.00 mul rcx
+ 1 1 0.50 shr rdx
+ 1 1 0.50 lea rax, [rdx + 2*rdx]
+ 1 1 0.33 sub rsi, rax
+ 1 1 0.33 or rax, -4
+ 1 1 0.33 add rsi, rdi
+ 1 1 0.33 add rax, rsi
+ 1 1 0.33 add rax, -8
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 6.65 6.67 - 6.68 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.90 0.10 - - - - lea eax, [rsi + rdi]
+ - - 0.93 - - 0.07 - - test al, 3
+ - - - - - 1.00 - - jne .LBB5_1
+ - - 0.51 0.47 - 0.02 - - movabs rax, 9223372036854775804
+ - - - - - 1.00 - - and rax, rsi
+ - - - 0.09 - 0.91 - - cmp rax, 9
+ - - - - - 1.00 - - jae .LBB5_3
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
+ - - 0.43 0.47 - 0.10 - - add rax, -9
+ - - 0.42 0.39 - 0.19 - - movabs rcx, -6148914691236517205
+ - - 1.00 1.00 - - - - mul rcx
+ - - 0.69 - - 0.31 - - shr rdx
+ - - 0.54 0.46 - - - - lea rax, [rdx + 2*rdx]
+ - - 0.07 0.91 - 0.02 - - sub rsi, rax
+ - - 0.91 0.05 - 0.04 - - or rax, -4
+ - - 0.08 0.90 - 0.02 - - add rsi, rdi
+ - - 0.09 0.91 - - - - add rax, rsi
+ - - 0.08 0.92 - - - - add rax, -8
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_suffix_dynamic_size.rs b/rust/zerocopy/benches/ref_from_suffix_dynamic_size.rs
new file mode 100644
index 000000000..3437b14f4
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_dynamic_size.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_suffix_dynamic_size(source: &[u8]) -> Option<&format::LocoPacket> {
+ match zerocopy::FromBytes::ref_from_suffix(source) {
+ Ok((_rest, packet)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/ref_from_suffix_dynamic_size.x86-64 b/rust/zerocopy/benches/ref_from_suffix_dynamic_size.x86-64
new file mode 100644
index 000000000..bd4ace898
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_dynamic_size.x86-64
@@ -0,0 +1,13 @@
+bench_ref_from_suffix_dynamic_size:
+ mov rdx, rsi
+ lea ecx, [rsi + rdi]
+ mov eax, edx
+ and eax, 1
+ add rax, rdi
+ xor esi, esi
+ sub rdx, 4
+ cmovb rax, rsi
+ shr rdx
+ test cl, 1
+ cmovne rax, rsi
+ ret
diff --git a/rust/zerocopy/benches/ref_from_suffix_dynamic_size.x86-64.mca b/rust/zerocopy/benches/ref_from_suffix_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..1398bcfe2
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_dynamic_size.x86-64.mca
@@ -0,0 +1,63 @@
+Iterations: 100
+Instructions: 1200
+Total Cycles: 439
+Total uOps: 1400
+
+Dispatch Width: 4
+uOps Per Cycle: 3.19
+IPC: 2.73
+Block RThroughput: 3.5
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rdx, rsi
+ 1 1 0.50 lea ecx, [rsi + rdi]
+ 1 1 0.33 mov eax, edx
+ 1 1 0.33 and eax, 1
+ 1 1 0.33 add rax, rdi
+ 1 0 0.25 xor esi, esi
+ 1 1 0.33 sub rdx, 4
+ 2 2 0.67 cmovb rax, rsi
+ 1 1 0.50 shr rdx
+ 1 1 0.33 test cl, 1
+ 2 2 0.67 cmovne rax, rsi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 4.33 4.33 - 4.34 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.02 0.32 - 0.66 - - mov rdx, rsi
+ - - 0.32 0.68 - - - - lea ecx, [rsi + rdi]
+ - - 0.66 - - 0.34 - - mov eax, edx
+ - - 0.02 0.33 - 0.65 - - and eax, 1
+ - - - 0.99 - 0.01 - - add rax, rdi
+ - - - - - - - - xor esi, esi
+ - - 0.65 - - 0.35 - - sub rdx, 4
+ - - 1.00 1.00 - - - - cmovb rax, rsi
+ - - 0.66 - - 0.34 - - shr rdx
+ - - - 0.01 - 0.99 - - test cl, 1
+ - - 1.00 1.00 - - - - cmovne rax, rsi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_suffix_static_size.rs b/rust/zerocopy/benches/ref_from_suffix_static_size.rs
new file mode 100644
index 000000000..c8435d10d
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_static_size.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_suffix_static_size(source: &[u8]) -> Option<&format::LocoPacket> {
+ match zerocopy::FromBytes::ref_from_suffix(source) {
+ Ok((_rest, packet)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/ref_from_suffix_static_size.x86-64 b/rust/zerocopy/benches/ref_from_suffix_static_size.x86-64
new file mode 100644
index 000000000..9e90b9e25
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_static_size.x86-64
@@ -0,0 +1,13 @@
+bench_ref_from_suffix_static_size:
+ lea eax, [rsi + rdi]
+ cmp rsi, 6
+ setb cl
+ or cl, al
+ test cl, 1
+ je .LBB5_2
+ xor eax, eax
+ ret
+.LBB5_2:
+ lea rax, [rdi + rsi]
+ add rax, -6
+ ret
diff --git a/rust/zerocopy/benches/ref_from_suffix_static_size.x86-64.mca b/rust/zerocopy/benches/ref_from_suffix_static_size.x86-64.mca
new file mode 100644
index 000000000..ef5892647
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_static_size.x86-64.mca
@@ -0,0 +1,61 @@
+Iterations: 100
+Instructions: 1100
+Total Cycles: 338
+Total uOps: 1100
+
+Dispatch Width: 4
+uOps Per Cycle: 3.25
+IPC: 3.25
+Block RThroughput: 3.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.50 lea eax, [rsi + rdi]
+ 1 1 0.33 cmp rsi, 6
+ 1 1 0.50 setb cl
+ 1 1 0.33 or cl, al
+ 1 1 0.33 test cl, 1
+ 1 1 1.00 je .LBB5_2
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+ 1 1 0.50 lea rax, [rdi + rsi]
+ 1 1 0.33 add rax, -6
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 3.32 3.33 - 3.35 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.97 0.03 - - - - lea eax, [rsi + rdi]
+ - - 0.33 0.32 - 0.35 - - cmp rsi, 6
+ - - 1.00 - - - - - setb cl
+ - - - 1.00 - - - - or cl, al
+ - - - 1.00 - - - - test cl, 1
+ - - - - - 1.00 - - je .LBB5_2
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
+ - - 0.34 0.66 - - - - lea rax, [rdi + rsi]
+ - - 0.68 0.32 - - - - add rax, -6
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_padding.rs b/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_padding.rs
new file mode 100644
index 000000000..73d91cee5
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_padding.rs
@@ -0,0 +1,13 @@
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_suffix_with_elems_dynamic_padding(
+ source: &[u8],
+ count: usize,
+) -> Option<&format::LocoPacket> {
+ match zerocopy::FromBytes::ref_from_suffix_with_elems(source, count) {
+ Ok((_rest, packet)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_padding.x86-64 b/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_padding.x86-64
new file mode 100644
index 000000000..c3d10b5fc
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_padding.x86-64
@@ -0,0 +1,27 @@
+bench_ref_from_suffix_with_elems_dynamic_padding:
+ movabs rax, 3074457345618258598
+ cmp rdx, rax
+ ja .LBB5_1
+ lea r8d, [rsi + rdi]
+ xor ecx, ecx
+ mov eax, 0
+ test r8b, 3
+ je .LBB5_3
+ mov rdx, rcx
+ ret
+.LBB5_3:
+ lea rax, [rdx + 2*rdx]
+ or rax, 3
+ add rax, 9
+ sub rsi, rax
+ jae .LBB5_4
+.LBB5_1:
+ xor eax, eax
+ mov edx, 1
+ ret
+.LBB5_4:
+ add rdi, rsi
+ mov rcx, rdx
+ mov rax, rdi
+ mov rdx, rcx
+ ret
diff --git a/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..92e6280bb
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_padding.x86-64.mca
@@ -0,0 +1,85 @@
+Iterations: 100
+Instructions: 2300
+Total Cycles: 706
+Total uOps: 2300
+
+Dispatch Width: 4
+uOps Per Cycle: 3.26
+IPC: 3.26
+Block RThroughput: 6.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movabs rax, 3074457345618258598
+ 1 1 0.33 cmp rdx, rax
+ 1 1 1.00 ja .LBB5_1
+ 1 1 0.50 lea r8d, [rsi + rdi]
+ 1 0 0.25 xor ecx, ecx
+ 1 1 0.33 mov eax, 0
+ 1 1 0.33 test r8b, 3
+ 1 1 1.00 je .LBB5_3
+ 1 1 0.33 mov rdx, rcx
+ 1 1 1.00 U ret
+ 1 1 0.50 lea rax, [rdx + 2*rdx]
+ 1 1 0.33 or rax, 3
+ 1 1 0.33 add rax, 9
+ 1 1 0.33 sub rsi, rax
+ 1 1 1.00 jae .LBB5_4
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 mov edx, 1
+ 1 1 1.00 U ret
+ 1 1 0.33 add rdi, rsi
+ 1 1 0.33 mov rcx, rdx
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 mov rdx, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 6.99 7.00 - 7.01 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - 0.99 - 0.01 - - movabs rax, 3074457345618258598
+ - - 0.01 0.50 - 0.49 - - cmp rdx, rax
+ - - - - - 1.00 - - ja .LBB5_1
+ - - - 1.00 - - - - lea r8d, [rsi + rdi]
+ - - - - - - - - xor ecx, ecx
+ - - 0.50 0.49 - 0.01 - - mov eax, 0
+ - - 0.49 0.51 - - - - test r8b, 3
+ - - - - - 1.00 - - je .LBB5_3
+ - - 0.51 0.49 - - - - mov rdx, rcx
+ - - - - - 1.00 - - ret
+ - - 0.50 0.50 - - - - lea rax, [rdx + 2*rdx]
+ - - 1.00 - - - - - or rax, 3
+ - - 1.00 - - - - - add rax, 9
+ - - 0.99 0.01 - - - - sub rsi, rax
+ - - - - - 1.00 - - jae .LBB5_4
+ - - - - - - - - xor eax, eax
+ - - - 1.00 - - - - mov edx, 1
+ - - - - - 1.00 - - ret
+ - - 1.00 - - - - - add rdi, rsi
+ - - - 1.00 - - - - mov rcx, rdx
+ - - 0.99 0.01 - - - - mov rax, rdi
+ - - - 0.50 - 0.50 - - mov rdx, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_size.rs b/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_size.rs
new file mode 100644
index 000000000..68a28baf5
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_size.rs
@@ -0,0 +1,13 @@
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_ref_from_suffix_with_elems_dynamic_size(
+ source: &[u8],
+ count: usize,
+) -> Option<&format::LocoPacket> {
+ match zerocopy::FromBytes::ref_from_suffix_with_elems(source, count) {
+ Ok((_rest, packet)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_size.x86-64 b/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_size.x86-64
new file mode 100644
index 000000000..bdca57192
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_size.x86-64
@@ -0,0 +1,23 @@
+bench_ref_from_suffix_with_elems_dynamic_size:
+ movabs rax, 4611686018427387901
+ cmp rdx, rax
+ ja .LBB5_1
+ lea r8d, [rsi + rdi]
+ xor ecx, ecx
+ mov eax, 0
+ test r8b, 1
+ jne .LBB5_5
+ lea rax, [2*rdx + 4]
+ sub rsi, rax
+ jae .LBB5_4
+.LBB5_1:
+ xor eax, eax
+ mov edx, 1
+ ret
+.LBB5_4:
+ add rdi, rsi
+ mov rcx, rdx
+ mov rax, rdi
+.LBB5_5:
+ mov rdx, rcx
+ ret
diff --git a/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_size.x86-64.mca b/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..6d9de0b3e
--- /dev/null
+++ b/rust/zerocopy/benches/ref_from_suffix_with_elems_dynamic_size.x86-64.mca
@@ -0,0 +1,77 @@
+Iterations: 100
+Instructions: 1900
+Total Cycles: 571
+Total uOps: 1900
+
+Dispatch Width: 4
+uOps Per Cycle: 3.33
+IPC: 3.33
+Block RThroughput: 5.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movabs rax, 4611686018427387901
+ 1 1 0.33 cmp rdx, rax
+ 1 1 1.00 ja .LBB5_1
+ 1 1 0.50 lea r8d, [rsi + rdi]
+ 1 0 0.25 xor ecx, ecx
+ 1 1 0.33 mov eax, 0
+ 1 1 0.33 test r8b, 1
+ 1 1 1.00 jne .LBB5_5
+ 1 1 0.50 lea rax, [2*rdx + 4]
+ 1 1 0.33 sub rsi, rax
+ 1 1 1.00 jae .LBB5_4
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 mov edx, 1
+ 1 1 1.00 U ret
+ 1 1 0.33 add rdi, rsi
+ 1 1 0.33 mov rcx, rdx
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 mov rdx, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 5.66 5.66 - 5.68 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.66 0.33 - 0.01 - - movabs rax, 4611686018427387901
+ - - 0.01 0.99 - - - - cmp rdx, rax
+ - - - - - 1.00 - - ja .LBB5_1
+ - - 0.99 0.01 - - - - lea r8d, [rsi + rdi]
+ - - - - - - - - xor ecx, ecx
+ - - 0.33 0.33 - 0.34 - - mov eax, 0
+ - - 0.33 0.34 - 0.33 - - test r8b, 1
+ - - - - - 1.00 - - jne .LBB5_5
+ - - 0.34 0.66 - - - - lea rax, [2*rdx + 4]
+ - - - 1.00 - - - - sub rsi, rax
+ - - - - - 1.00 - - jae .LBB5_4
+ - - - - - - - - xor eax, eax
+ - - 1.00 - - - - - mov edx, 1
+ - - - - - 1.00 - - ret
+ - - - 1.00 - - - - add rdi, rsi
+ - - 1.00 - - - - - mov rcx, rdx
+ - - 0.32 0.68 - - - - mov rax, rdi
+ - - 0.68 0.32 - - - - mov rdx, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/split_at_dynamic_padding.rs b/rust/zerocopy/benches/split_at_dynamic_padding.rs
new file mode 100644
index 000000000..bed90f601
--- /dev/null
+++ b/rust/zerocopy/benches/split_at_dynamic_padding.rs
@@ -0,0 +1,12 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_split_at_dynamic_padding(
+ source: &format::CocoPacket,
+ len: usize,
+) -> Option<Split<&format::CocoPacket>> {
+ source.split_at(len)
+}
diff --git a/rust/zerocopy/benches/split_at_dynamic_padding.x86-64 b/rust/zerocopy/benches/split_at_dynamic_padding.x86-64
new file mode 100644
index 000000000..6eaf5a004
--- /dev/null
+++ b/rust/zerocopy/benches/split_at_dynamic_padding.x86-64
@@ -0,0 +1,12 @@
+bench_split_at_dynamic_padding:
+ mov rax, rdi
+ cmp rcx, rdx
+ jbe .LBB5_2
+ xor esi, esi
+ mov qword ptr [rax], rsi
+ ret
+.LBB5_2:
+ mov qword ptr [rax + 8], rdx
+ mov qword ptr [rax + 16], rcx
+ mov qword ptr [rax], rsi
+ ret
diff --git a/rust/zerocopy/benches/split_at_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/split_at_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..19ab3414d
--- /dev/null
+++ b/rust/zerocopy/benches/split_at_dynamic_padding.x86-64.mca
@@ -0,0 +1,59 @@
+Iterations: 100
+Instructions: 1000
+Total Cycles: 404
+Total uOps: 1000
+
+Dispatch Width: 4
+uOps Per Cycle: 2.48
+IPC: 2.48
+Block RThroughput: 4.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 cmp rcx, rdx
+ 1 1 1.00 jbe .LBB5_2
+ 1 0 0.25 xor esi, esi
+ 1 1 1.00 * mov qword ptr [rax], rsi
+ 1 1 1.00 U ret
+ 1 1 1.00 * mov qword ptr [rax + 8], rdx
+ 1 1 1.00 * mov qword ptr [rax + 16], rcx
+ 1 1 1.00 * mov qword ptr [rax], rsi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 0.99 1.00 4.00 3.01 2.00 2.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.99 - - 0.01 - - mov rax, rdi
+ - - - 1.00 - - - - cmp rcx, rdx
+ - - - - - 1.00 - - jbe .LBB5_2
+ - - - - - - - - xor esi, esi
+ - - - - 1.00 - - 1.00 mov qword ptr [rax], rsi
+ - - - - - 1.00 - - ret
+ - - - - 1.00 - 1.00 - mov qword ptr [rax + 8], rdx
+ - - - - 1.00 - - 1.00 mov qword ptr [rax + 16], rcx
+ - - - - 1.00 - 1.00 - mov qword ptr [rax], rsi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/split_at_dynamic_size.rs b/rust/zerocopy/benches/split_at_dynamic_size.rs
new file mode 100644
index 000000000..07a22ba2e
--- /dev/null
+++ b/rust/zerocopy/benches/split_at_dynamic_size.rs
@@ -0,0 +1,12 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_split_at_dynamic_size(
+ source: &format::CocoPacket,
+ len: usize,
+) -> Option<Split<&format::CocoPacket>> {
+ source.split_at(len)
+}
diff --git a/rust/zerocopy/benches/split_at_dynamic_size.x86-64 b/rust/zerocopy/benches/split_at_dynamic_size.x86-64
new file mode 100644
index 000000000..8d81b98bd
--- /dev/null
+++ b/rust/zerocopy/benches/split_at_dynamic_size.x86-64
@@ -0,0 +1,12 @@
+bench_split_at_dynamic_size:
+ mov rax, rdi
+ cmp rcx, rdx
+ jbe .LBB5_2
+ xor esi, esi
+ mov qword ptr [rax], rsi
+ ret
+.LBB5_2:
+ mov qword ptr [rax + 8], rdx
+ mov qword ptr [rax + 16], rcx
+ mov qword ptr [rax], rsi
+ ret
diff --git a/rust/zerocopy/benches/split_at_dynamic_size.x86-64.mca b/rust/zerocopy/benches/split_at_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..19ab3414d
--- /dev/null
+++ b/rust/zerocopy/benches/split_at_dynamic_size.x86-64.mca
@@ -0,0 +1,59 @@
+Iterations: 100
+Instructions: 1000
+Total Cycles: 404
+Total uOps: 1000
+
+Dispatch Width: 4
+uOps Per Cycle: 2.48
+IPC: 2.48
+Block RThroughput: 4.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 cmp rcx, rdx
+ 1 1 1.00 jbe .LBB5_2
+ 1 0 0.25 xor esi, esi
+ 1 1 1.00 * mov qword ptr [rax], rsi
+ 1 1 1.00 U ret
+ 1 1 1.00 * mov qword ptr [rax + 8], rdx
+ 1 1 1.00 * mov qword ptr [rax + 16], rcx
+ 1 1 1.00 * mov qword ptr [rax], rsi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 0.99 1.00 4.00 3.01 2.00 2.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.99 - - 0.01 - - mov rax, rdi
+ - - - 1.00 - - - - cmp rcx, rdx
+ - - - - - 1.00 - - jbe .LBB5_2
+ - - - - - - - - xor esi, esi
+ - - - - 1.00 - - 1.00 mov qword ptr [rax], rsi
+ - - - - - 1.00 - - ret
+ - - - - 1.00 - 1.00 - mov qword ptr [rax + 8], rdx
+ - - - - 1.00 - - 1.00 mov qword ptr [rax + 16], rcx
+ - - - - 1.00 - 1.00 - mov qword ptr [rax], rsi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/split_at_unchecked_dynamic_padding.rs b/rust/zerocopy/benches/split_at_unchecked_dynamic_padding.rs
new file mode 100644
index 000000000..3c147d3bd
--- /dev/null
+++ b/rust/zerocopy/benches/split_at_unchecked_dynamic_padding.rs
@@ -0,0 +1,12 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+unsafe fn bench_split_at_unchecked_dynamic_padding(
+ source: &format::CocoPacket,
+ len: usize,
+) -> Split<&format::CocoPacket> {
+ unsafe { source.split_at_unchecked(len) }
+}
diff --git a/rust/zerocopy/benches/split_at_unchecked_dynamic_padding.x86-64 b/rust/zerocopy/benches/split_at_unchecked_dynamic_padding.x86-64
new file mode 100644
index 000000000..74c3b52f6
--- /dev/null
+++ b/rust/zerocopy/benches/split_at_unchecked_dynamic_padding.x86-64
@@ -0,0 +1,6 @@
+bench_split_at_unchecked_dynamic_padding:
+ mov rax, rdi
+ mov qword ptr [rdi], rsi
+ mov qword ptr [rdi + 8], rdx
+ mov qword ptr [rdi + 16], rcx
+ ret
diff --git a/rust/zerocopy/benches/split_at_unchecked_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/split_at_unchecked_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..e8c61591c
--- /dev/null
+++ b/rust/zerocopy/benches/split_at_unchecked_dynamic_padding.x86-64.mca
@@ -0,0 +1,49 @@
+Iterations: 100
+Instructions: 500
+Total Cycles: 303
+Total uOps: 500
+
+Dispatch Width: 4
+uOps Per Cycle: 1.65
+IPC: 1.65
+Block RThroughput: 3.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 1 1.00 * mov qword ptr [rdi], rsi
+ 1 1 1.00 * mov qword ptr [rdi + 8], rdx
+ 1 1 1.00 * mov qword ptr [rdi + 16], rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 0.49 0.50 3.00 1.01 1.50 1.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.49 0.50 - 0.01 - - mov rax, rdi
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rdi], rsi
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rdi + 8], rdx
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rdi + 16], rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/split_at_unchecked_dynamic_size.rs b/rust/zerocopy/benches/split_at_unchecked_dynamic_size.rs
new file mode 100644
index 000000000..b1aa1dfb3
--- /dev/null
+++ b/rust/zerocopy/benches/split_at_unchecked_dynamic_size.rs
@@ -0,0 +1,12 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+unsafe fn bench_split_at_unchecked_dynamic_size(
+ source: &format::CocoPacket,
+ len: usize,
+) -> Split<&format::CocoPacket> {
+ unsafe { source.split_at_unchecked(len) }
+}
diff --git a/rust/zerocopy/benches/split_at_unchecked_dynamic_size.x86-64 b/rust/zerocopy/benches/split_at_unchecked_dynamic_size.x86-64
new file mode 100644
index 000000000..56671d1ee
--- /dev/null
+++ b/rust/zerocopy/benches/split_at_unchecked_dynamic_size.x86-64
@@ -0,0 +1,6 @@
+bench_split_at_unchecked_dynamic_size:
+ mov rax, rdi
+ mov qword ptr [rdi], rsi
+ mov qword ptr [rdi + 8], rdx
+ mov qword ptr [rdi + 16], rcx
+ ret
diff --git a/rust/zerocopy/benches/split_at_unchecked_dynamic_size.x86-64.mca b/rust/zerocopy/benches/split_at_unchecked_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..e8c61591c
--- /dev/null
+++ b/rust/zerocopy/benches/split_at_unchecked_dynamic_size.x86-64.mca
@@ -0,0 +1,49 @@
+Iterations: 100
+Instructions: 500
+Total Cycles: 303
+Total uOps: 500
+
+Dispatch Width: 4
+uOps Per Cycle: 1.65
+IPC: 1.65
+Block RThroughput: 3.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 1 1.00 * mov qword ptr [rdi], rsi
+ 1 1 1.00 * mov qword ptr [rdi + 8], rdx
+ 1 1 1.00 * mov qword ptr [rdi + 16], rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 0.49 0.50 3.00 1.01 1.50 1.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.49 0.50 - 0.01 - - mov rax, rdi
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rdi], rsi
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rdi + 8], rdx
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rdi + 16], rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/split_via_immutable_dynamic_padding.rs b/rust/zerocopy/benches/split_via_immutable_dynamic_padding.rs
new file mode 100644
index 000000000..b86ad3614
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_immutable_dynamic_padding.rs
@@ -0,0 +1,11 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_split_via_immutable_dynamic_padding(
+ split: Split<&format::CocoPacket>,
+) -> (&format::CocoPacket, &[[u8; 3]]) {
+ split.via_immutable()
+}
diff --git a/rust/zerocopy/benches/split_via_immutable_dynamic_padding.x86-64 b/rust/zerocopy/benches/split_via_immutable_dynamic_padding.x86-64
new file mode 100644
index 000000000..dac183428
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_immutable_dynamic_padding.x86-64
@@ -0,0 +1,14 @@
+bench_split_via_immutable_dynamic_padding:
+ mov rax, rdi
+ mov rcx, qword ptr [rsi]
+ mov rdx, qword ptr [rsi + 8]
+ mov rsi, qword ptr [rsi + 16]
+ lea rdi, [rsi + 2*rsi]
+ add rdi, rcx
+ add rdi, 9
+ sub rdx, rsi
+ mov qword ptr [rax], rcx
+ mov qword ptr [rax + 8], rsi
+ mov qword ptr [rax + 16], rdi
+ mov qword ptr [rax + 24], rdx
+ ret
diff --git a/rust/zerocopy/benches/split_via_immutable_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/split_via_immutable_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..6ab4e8387
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_immutable_dynamic_padding.x86-64.mca
@@ -0,0 +1,65 @@
+Iterations: 100
+Instructions: 1300
+Total Cycles: 510
+Total uOps: 1300
+
+Dispatch Width: 4
+uOps Per Cycle: 2.55
+IPC: 2.55
+Block RThroughput: 4.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 5 0.50 * mov rcx, qword ptr [rsi]
+ 1 5 0.50 * mov rdx, qword ptr [rsi + 8]
+ 1 5 0.50 * mov rsi, qword ptr [rsi + 16]
+ 1 1 0.50 lea rdi, [rsi + 2*rsi]
+ 1 1 0.33 add rdi, rcx
+ 1 1 0.33 add rdi, 9
+ 1 1 0.33 sub rdx, rsi
+ 1 1 1.00 * mov qword ptr [rax], rcx
+ 1 1 1.00 * mov qword ptr [rax + 8], rsi
+ 1 1 1.00 * mov qword ptr [rax + 16], rdi
+ 1 1 1.00 * mov qword ptr [rax + 24], rdx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 2.00 2.00 4.00 2.00 3.50 3.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.03 0.93 - 0.04 - - mov rax, rdi
+ - - - - - - 0.49 0.51 mov rcx, qword ptr [rsi]
+ - - - - - - 1.00 - mov rdx, qword ptr [rsi + 8]
+ - - - - - - 0.01 0.99 mov rsi, qword ptr [rsi + 16]
+ - - 0.93 0.07 - - - - lea rdi, [rsi + 2*rsi]
+ - - 0.05 0.02 - 0.93 - - add rdi, rcx
+ - - 0.49 0.49 - 0.02 - - add rdi, 9
+ - - 0.50 0.49 - 0.01 - - sub rdx, rsi
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rax], rcx
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rax + 8], rsi
+ - - - - 1.00 - 0.49 0.51 mov qword ptr [rax + 16], rdi
+ - - - - 1.00 - 0.51 0.49 mov qword ptr [rax + 24], rdx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/split_via_immutable_dynamic_size.rs b/rust/zerocopy/benches/split_via_immutable_dynamic_size.rs
new file mode 100644
index 000000000..7d115caa3
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_immutable_dynamic_size.rs
@@ -0,0 +1,11 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_split_via_immutable_dynamic_size(
+ split: Split<&format::CocoPacket>,
+) -> (&format::CocoPacket, &[[u8; 2]]) {
+ split.via_immutable()
+}
diff --git a/rust/zerocopy/benches/split_via_immutable_dynamic_size.x86-64 b/rust/zerocopy/benches/split_via_immutable_dynamic_size.x86-64
new file mode 100644
index 000000000..58f6b09fc
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_immutable_dynamic_size.x86-64
@@ -0,0 +1,13 @@
+bench_split_via_immutable_dynamic_size:
+ mov rax, rdi
+ mov rcx, qword ptr [rsi]
+ mov rdx, qword ptr [rsi + 8]
+ mov rsi, qword ptr [rsi + 16]
+ lea rdi, [rcx + 2*rsi]
+ add rdi, 4
+ sub rdx, rsi
+ mov qword ptr [rax], rcx
+ mov qword ptr [rax + 8], rsi
+ mov qword ptr [rax + 16], rdi
+ mov qword ptr [rax + 24], rdx
+ ret
diff --git a/rust/zerocopy/benches/split_via_immutable_dynamic_size.x86-64.mca b/rust/zerocopy/benches/split_via_immutable_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..4549f20de
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_immutable_dynamic_size.x86-64.mca
@@ -0,0 +1,63 @@
+Iterations: 100
+Instructions: 1200
+Total Cycles: 509
+Total uOps: 1200
+
+Dispatch Width: 4
+uOps Per Cycle: 2.36
+IPC: 2.36
+Block RThroughput: 4.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 5 0.50 * mov rcx, qword ptr [rsi]
+ 1 5 0.50 * mov rdx, qword ptr [rsi + 8]
+ 1 5 0.50 * mov rsi, qword ptr [rsi + 16]
+ 1 1 0.50 lea rdi, [rcx + 2*rsi]
+ 1 1 0.33 add rdi, 4
+ 1 1 0.33 sub rdx, rsi
+ 1 1 1.00 * mov qword ptr [rax], rcx
+ 1 1 1.00 * mov qword ptr [rax + 8], rsi
+ 1 1 1.00 * mov qword ptr [rax + 16], rdi
+ 1 1 1.00 * mov qword ptr [rax + 24], rdx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 1.66 1.66 4.00 1.68 3.50 3.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.34 0.33 - 0.33 - - mov rax, rdi
+ - - - - - - 0.49 0.51 mov rcx, qword ptr [rsi]
+ - - - - - - 0.51 0.49 mov rdx, qword ptr [rsi + 8]
+ - - - - - - 0.01 0.99 mov rsi, qword ptr [rsi + 16]
+ - - 0.33 0.67 - - - - lea rdi, [rcx + 2*rsi]
+ - - 0.63 0.34 - 0.03 - - add rdi, 4
+ - - 0.36 0.32 - 0.32 - - sub rdx, rsi
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rax], rcx
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rax + 8], rsi
+ - - - - 1.00 - 0.98 0.02 mov qword ptr [rax + 16], rdi
+ - - - - 1.00 - 0.51 0.49 mov qword ptr [rax + 24], rdx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/split_via_runtime_check_dynamic_padding.rs b/rust/zerocopy/benches/split_via_runtime_check_dynamic_padding.rs
new file mode 100644
index 000000000..edba7bf34
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_runtime_check_dynamic_padding.rs
@@ -0,0 +1,11 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_split_via_runtime_check_dynamic_padding(
+ split: Split<&format::CocoPacket>,
+) -> Option<(&format::CocoPacket, &[[u8; 3]])> {
+ split.via_runtime_check().ok()
+}
diff --git a/rust/zerocopy/benches/split_via_runtime_check_dynamic_padding.x86-64 b/rust/zerocopy/benches/split_via_runtime_check_dynamic_padding.x86-64
new file mode 100644
index 000000000..03684cb09
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_runtime_check_dynamic_padding.x86-64
@@ -0,0 +1,22 @@
+bench_split_via_runtime_check_dynamic_padding:
+ mov rax, rdi
+ mov rdx, qword ptr [rsi + 16]
+ mov ecx, edx
+ and ecx, 3
+ cmp ecx, 1
+ jne .LBB5_1
+ mov rcx, qword ptr [rsi]
+ mov rsi, qword ptr [rsi + 8]
+ lea rdi, [rdx + 2*rdx]
+ add rdi, rcx
+ add rdi, 9
+ sub rsi, rdx
+ mov qword ptr [rax + 8], rdx
+ mov qword ptr [rax + 16], rdi
+ mov qword ptr [rax + 24], rsi
+ mov qword ptr [rax], rcx
+ ret
+.LBB5_1:
+ xor ecx, ecx
+ mov qword ptr [rax], rcx
+ ret
diff --git a/rust/zerocopy/benches/split_via_runtime_check_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/split_via_runtime_check_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..5034ab058
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_runtime_check_dynamic_padding.x86-64.mca
@@ -0,0 +1,79 @@
+Iterations: 100
+Instructions: 2000
+Total Cycles: 708
+Total uOps: 2000
+
+Dispatch Width: 4
+uOps Per Cycle: 2.82
+IPC: 2.82
+Block RThroughput: 5.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 5 0.50 * mov rdx, qword ptr [rsi + 16]
+ 1 1 0.33 mov ecx, edx
+ 1 1 0.33 and ecx, 3
+ 1 1 0.33 cmp ecx, 1
+ 1 1 1.00 jne .LBB5_1
+ 1 5 0.50 * mov rcx, qword ptr [rsi]
+ 1 5 0.50 * mov rsi, qword ptr [rsi + 8]
+ 1 1 0.50 lea rdi, [rdx + 2*rdx]
+ 1 1 0.33 add rdi, rcx
+ 1 1 0.33 add rdi, 9
+ 1 1 0.33 sub rsi, rdx
+ 1 1 1.00 * mov qword ptr [rax + 8], rdx
+ 1 1 1.00 * mov qword ptr [rax + 16], rdi
+ 1 1 1.00 * mov qword ptr [rax + 24], rsi
+ 1 1 1.00 * mov qword ptr [rax], rcx
+ 1 1 1.00 U ret
+ 1 0 0.25 xor ecx, ecx
+ 1 1 1.00 * mov qword ptr [rax], rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 3.00 3.02 5.00 4.98 4.00 4.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - 0.99 - 0.01 - - mov rax, rdi
+ - - - - - - - 1.00 mov rdx, qword ptr [rsi + 16]
+ - - 0.99 0.01 - - - - mov ecx, edx
+ - - 0.99 0.01 - - - - and ecx, 3
+ - - 0.97 0.03 - - - - cmp ecx, 1
+ - - - - - 1.00 - - jne .LBB5_1
+ - - - - - - 1.00 - mov rcx, qword ptr [rsi]
+ - - - - - - 0.99 0.01 mov rsi, qword ptr [rsi + 8]
+ - - 0.01 0.99 - - - - lea rdi, [rdx + 2*rdx]
+ - - - 0.96 - 0.04 - - add rdi, rcx
+ - - 0.03 - - 0.97 - - add rdi, 9
+ - - 0.01 0.03 - 0.96 - - sub rsi, rdx
+ - - - - 1.00 - 1.00 - mov qword ptr [rax + 8], rdx
+ - - - - 1.00 - - 1.00 mov qword ptr [rax + 16], rdi
+ - - - - 1.00 - 0.01 0.99 mov qword ptr [rax + 24], rsi
+ - - - - 1.00 - 0.99 0.01 mov qword ptr [rax], rcx
+ - - - - - 1.00 - - ret
+ - - - - - - - - xor ecx, ecx
+ - - - - 1.00 - 0.01 0.99 mov qword ptr [rax], rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/split_via_runtime_check_dynamic_size.rs b/rust/zerocopy/benches/split_via_runtime_check_dynamic_size.rs
new file mode 100644
index 000000000..ce22de909
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_runtime_check_dynamic_size.rs
@@ -0,0 +1,11 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_split_via_runtime_check_dynamic_size(
+ split: Split<&format::CocoPacket>,
+) -> Option<(&format::CocoPacket, &[[u8; 2]])> {
+ split.via_runtime_check().ok()
+}
diff --git a/rust/zerocopy/benches/split_via_runtime_check_dynamic_size.x86-64 b/rust/zerocopy/benches/split_via_runtime_check_dynamic_size.x86-64
new file mode 100644
index 000000000..e54276bd8
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_runtime_check_dynamic_size.x86-64
@@ -0,0 +1,13 @@
+bench_split_via_runtime_check_dynamic_size:
+ mov rax, rdi
+ mov rcx, qword ptr [rsi]
+ mov rdx, qword ptr [rsi + 8]
+ mov rsi, qword ptr [rsi + 16]
+ lea rdi, [rcx + 2*rsi]
+ add rdi, 4
+ sub rdx, rsi
+ mov qword ptr [rax], rcx
+ mov qword ptr [rax + 8], rsi
+ mov qword ptr [rax + 16], rdi
+ mov qword ptr [rax + 24], rdx
+ ret
diff --git a/rust/zerocopy/benches/split_via_runtime_check_dynamic_size.x86-64.mca b/rust/zerocopy/benches/split_via_runtime_check_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..4549f20de
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_runtime_check_dynamic_size.x86-64.mca
@@ -0,0 +1,63 @@
+Iterations: 100
+Instructions: 1200
+Total Cycles: 509
+Total uOps: 1200
+
+Dispatch Width: 4
+uOps Per Cycle: 2.36
+IPC: 2.36
+Block RThroughput: 4.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 5 0.50 * mov rcx, qword ptr [rsi]
+ 1 5 0.50 * mov rdx, qword ptr [rsi + 8]
+ 1 5 0.50 * mov rsi, qword ptr [rsi + 16]
+ 1 1 0.50 lea rdi, [rcx + 2*rsi]
+ 1 1 0.33 add rdi, 4
+ 1 1 0.33 sub rdx, rsi
+ 1 1 1.00 * mov qword ptr [rax], rcx
+ 1 1 1.00 * mov qword ptr [rax + 8], rsi
+ 1 1 1.00 * mov qword ptr [rax + 16], rdi
+ 1 1 1.00 * mov qword ptr [rax + 24], rdx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 1.66 1.66 4.00 1.68 3.50 3.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.34 0.33 - 0.33 - - mov rax, rdi
+ - - - - - - 0.49 0.51 mov rcx, qword ptr [rsi]
+ - - - - - - 0.51 0.49 mov rdx, qword ptr [rsi + 8]
+ - - - - - - 0.01 0.99 mov rsi, qword ptr [rsi + 16]
+ - - 0.33 0.67 - - - - lea rdi, [rcx + 2*rsi]
+ - - 0.63 0.34 - 0.03 - - add rdi, 4
+ - - 0.36 0.32 - 0.32 - - sub rdx, rsi
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rax], rcx
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rax + 8], rsi
+ - - - - 1.00 - 0.98 0.02 mov qword ptr [rax + 16], rdi
+ - - - - 1.00 - 0.51 0.49 mov qword ptr [rax + 24], rdx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/split_via_unchecked_dynamic_padding.rs b/rust/zerocopy/benches/split_via_unchecked_dynamic_padding.rs
new file mode 100644
index 000000000..21d74dba1
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_unchecked_dynamic_padding.rs
@@ -0,0 +1,11 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+unsafe fn bench_split_via_unchecked_dynamic_padding(
+ split: Split<&format::CocoPacket>,
+) -> (&format::CocoPacket, &[[u8; 3]]) {
+ unsafe { split.via_unchecked() }
+}
diff --git a/rust/zerocopy/benches/split_via_unchecked_dynamic_padding.x86-64 b/rust/zerocopy/benches/split_via_unchecked_dynamic_padding.x86-64
new file mode 100644
index 000000000..3c2c4ec9f
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_unchecked_dynamic_padding.x86-64
@@ -0,0 +1,14 @@
+bench_split_via_unchecked_dynamic_padding:
+ mov rax, rdi
+ mov rcx, qword ptr [rsi]
+ mov rdx, qword ptr [rsi + 8]
+ mov rsi, qword ptr [rsi + 16]
+ lea rdi, [rsi + 2*rsi]
+ add rdi, rcx
+ add rdi, 9
+ sub rdx, rsi
+ mov qword ptr [rax], rcx
+ mov qword ptr [rax + 8], rsi
+ mov qword ptr [rax + 16], rdi
+ mov qword ptr [rax + 24], rdx
+ ret
diff --git a/rust/zerocopy/benches/split_via_unchecked_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/split_via_unchecked_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..6ab4e8387
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_unchecked_dynamic_padding.x86-64.mca
@@ -0,0 +1,65 @@
+Iterations: 100
+Instructions: 1300
+Total Cycles: 510
+Total uOps: 1300
+
+Dispatch Width: 4
+uOps Per Cycle: 2.55
+IPC: 2.55
+Block RThroughput: 4.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 5 0.50 * mov rcx, qword ptr [rsi]
+ 1 5 0.50 * mov rdx, qword ptr [rsi + 8]
+ 1 5 0.50 * mov rsi, qword ptr [rsi + 16]
+ 1 1 0.50 lea rdi, [rsi + 2*rsi]
+ 1 1 0.33 add rdi, rcx
+ 1 1 0.33 add rdi, 9
+ 1 1 0.33 sub rdx, rsi
+ 1 1 1.00 * mov qword ptr [rax], rcx
+ 1 1 1.00 * mov qword ptr [rax + 8], rsi
+ 1 1 1.00 * mov qword ptr [rax + 16], rdi
+ 1 1 1.00 * mov qword ptr [rax + 24], rdx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 2.00 2.00 4.00 2.00 3.50 3.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.03 0.93 - 0.04 - - mov rax, rdi
+ - - - - - - 0.49 0.51 mov rcx, qword ptr [rsi]
+ - - - - - - 1.00 - mov rdx, qword ptr [rsi + 8]
+ - - - - - - 0.01 0.99 mov rsi, qword ptr [rsi + 16]
+ - - 0.93 0.07 - - - - lea rdi, [rsi + 2*rsi]
+ - - 0.05 0.02 - 0.93 - - add rdi, rcx
+ - - 0.49 0.49 - 0.02 - - add rdi, 9
+ - - 0.50 0.49 - 0.01 - - sub rdx, rsi
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rax], rcx
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rax + 8], rsi
+ - - - - 1.00 - 0.49 0.51 mov qword ptr [rax + 16], rdi
+ - - - - 1.00 - 0.51 0.49 mov qword ptr [rax + 24], rdx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/split_via_unchecked_dynamic_size.rs b/rust/zerocopy/benches/split_via_unchecked_dynamic_size.rs
new file mode 100644
index 000000000..824e22d67
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_unchecked_dynamic_size.rs
@@ -0,0 +1,11 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+unsafe fn bench_split_via_unchecked_dynamic_size(
+ split: Split<&format::CocoPacket>,
+) -> (&format::CocoPacket, &[[u8; 2]]) {
+ unsafe { split.via_unchecked() }
+}
diff --git a/rust/zerocopy/benches/split_via_unchecked_dynamic_size.x86-64 b/rust/zerocopy/benches/split_via_unchecked_dynamic_size.x86-64
new file mode 100644
index 000000000..1e31268ed
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_unchecked_dynamic_size.x86-64
@@ -0,0 +1,13 @@
+bench_split_via_unchecked_dynamic_size:
+ mov rax, rdi
+ mov rcx, qword ptr [rsi]
+ mov rdx, qword ptr [rsi + 8]
+ mov rsi, qword ptr [rsi + 16]
+ lea rdi, [rcx + 2*rsi]
+ add rdi, 4
+ sub rdx, rsi
+ mov qword ptr [rax], rcx
+ mov qword ptr [rax + 8], rsi
+ mov qword ptr [rax + 16], rdi
+ mov qword ptr [rax + 24], rdx
+ ret
diff --git a/rust/zerocopy/benches/split_via_unchecked_dynamic_size.x86-64.mca b/rust/zerocopy/benches/split_via_unchecked_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..4549f20de
--- /dev/null
+++ b/rust/zerocopy/benches/split_via_unchecked_dynamic_size.x86-64.mca
@@ -0,0 +1,63 @@
+Iterations: 100
+Instructions: 1200
+Total Cycles: 509
+Total uOps: 1200
+
+Dispatch Width: 4
+uOps Per Cycle: 2.36
+IPC: 2.36
+Block RThroughput: 4.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 5 0.50 * mov rcx, qword ptr [rsi]
+ 1 5 0.50 * mov rdx, qword ptr [rsi + 8]
+ 1 5 0.50 * mov rsi, qword ptr [rsi + 16]
+ 1 1 0.50 lea rdi, [rcx + 2*rsi]
+ 1 1 0.33 add rdi, 4
+ 1 1 0.33 sub rdx, rsi
+ 1 1 1.00 * mov qword ptr [rax], rcx
+ 1 1 1.00 * mov qword ptr [rax + 8], rsi
+ 1 1 1.00 * mov qword ptr [rax + 16], rdi
+ 1 1 1.00 * mov qword ptr [rax + 24], rdx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 1.66 1.66 4.00 1.68 3.50 3.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.34 0.33 - 0.33 - - mov rax, rdi
+ - - - - - - 0.49 0.51 mov rcx, qword ptr [rsi]
+ - - - - - - 0.51 0.49 mov rdx, qword ptr [rsi + 8]
+ - - - - - - 0.01 0.99 mov rsi, qword ptr [rsi + 16]
+ - - 0.33 0.67 - - - - lea rdi, [rcx + 2*rsi]
+ - - 0.63 0.34 - 0.03 - - add rdi, 4
+ - - 0.36 0.32 - 0.32 - - sub rdx, rsi
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rax], rcx
+ - - - - 1.00 - 0.50 0.50 mov qword ptr [rax + 8], rsi
+ - - - - 1.00 - 0.98 0.02 mov qword ptr [rax + 16], rdi
+ - - - - 1.00 - 0.51 0.49 mov qword ptr [rax + 24], rdx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/transmute.rs b/rust/zerocopy/benches/transmute.rs
new file mode 100644
index 000000000..e60bfb252
--- /dev/null
+++ b/rust/zerocopy/benches/transmute.rs
@@ -0,0 +1,16 @@
+use zerocopy::Unalign;
+use zerocopy_derive::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[derive(IntoBytes, KnownLayout, Immutable)]
+#[repr(C)]
+struct MinimalViableSource {
+ bytes: [u8; 6],
+}
+
+#[unsafe(no_mangle)]
+fn bench_transmute(source: MinimalViableSource) -> Unalign<format::LocoPacket> {
+ zerocopy::transmute!(source)
+}
diff --git a/rust/zerocopy/benches/transmute.x86-64 b/rust/zerocopy/benches/transmute.x86-64
new file mode 100644
index 000000000..a4c6299d1
--- /dev/null
+++ b/rust/zerocopy/benches/transmute.x86-64
@@ -0,0 +1,3 @@
+bench_transmute:
+ mov rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/transmute.x86-64.mca b/rust/zerocopy/benches/transmute.x86-64.mca
new file mode 100644
index 000000000..f297729c6
--- /dev/null
+++ b/rust/zerocopy/benches/transmute.x86-64.mca
@@ -0,0 +1,43 @@
+Iterations: 100
+Instructions: 200
+Total Cycles: 104
+Total uOps: 200
+
+Dispatch Width: 4
+uOps Per Cycle: 1.92
+IPC: 1.92
+Block RThroughput: 1.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 0.49 0.50 - 1.01 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.49 0.50 - 0.01 - - mov rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/transmute_ref_dynamic_size.rs b/rust/zerocopy/benches/transmute_ref_dynamic_size.rs
new file mode 100644
index 000000000..825f0f2be
--- /dev/null
+++ b/rust/zerocopy/benches/transmute_ref_dynamic_size.rs
@@ -0,0 +1,16 @@
+use zerocopy_derive::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[derive(IntoBytes, KnownLayout, Immutable)]
+#[repr(C, align(2))]
+struct MinimalViableSource {
+ header: [u8; 6],
+ trailer: [[u8; 2]],
+}
+
+#[unsafe(no_mangle)]
+fn bench_transmute_ref_dynamic_size(source: &MinimalViableSource) -> &format::LocoPacket {
+ zerocopy::transmute_ref!(source)
+}
diff --git a/rust/zerocopy/benches/transmute_ref_dynamic_size.x86-64 b/rust/zerocopy/benches/transmute_ref_dynamic_size.x86-64
new file mode 100644
index 000000000..80a0f5906
--- /dev/null
+++ b/rust/zerocopy/benches/transmute_ref_dynamic_size.x86-64
@@ -0,0 +1,4 @@
+bench_transmute_ref_dynamic_size:
+ mov rax, rdi
+ lea rdx, [rsi + 1]
+ ret
diff --git a/rust/zerocopy/benches/transmute_ref_dynamic_size.x86-64.mca b/rust/zerocopy/benches/transmute_ref_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..ef1bcdca5
--- /dev/null
+++ b/rust/zerocopy/benches/transmute_ref_dynamic_size.x86-64.mca
@@ -0,0 +1,45 @@
+Iterations: 100
+Instructions: 300
+Total Cycles: 104
+Total uOps: 300
+
+Dispatch Width: 4
+uOps Per Cycle: 2.88
+IPC: 2.88
+Block RThroughput: 1.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.50 lea rdx, [rsi + 1]
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 0.99 1.00 - 1.01 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.99 - - 0.01 - - mov rax, rdi
+ - - - 1.00 - - - - lea rdx, [rsi + 1]
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/transmute_ref_static_size.rs b/rust/zerocopy/benches/transmute_ref_static_size.rs
new file mode 100644
index 000000000..a6db611fd
--- /dev/null
+++ b/rust/zerocopy/benches/transmute_ref_static_size.rs
@@ -0,0 +1,15 @@
+use zerocopy_derive::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[derive(IntoBytes, KnownLayout, Immutable)]
+#[repr(C, align(2))]
+struct MinimalViableSource {
+ bytes: [u8; 6],
+}
+
+#[unsafe(no_mangle)]
+fn bench_transmute_ref_static_size(source: &MinimalViableSource) -> &format::LocoPacket {
+ zerocopy::transmute_ref!(source)
+}
diff --git a/rust/zerocopy/benches/transmute_ref_static_size.x86-64 b/rust/zerocopy/benches/transmute_ref_static_size.x86-64
new file mode 100644
index 000000000..7a9229c12
--- /dev/null
+++ b/rust/zerocopy/benches/transmute_ref_static_size.x86-64
@@ -0,0 +1,3 @@
+bench_transmute_ref_static_size:
+ mov rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/transmute_ref_static_size.x86-64.mca b/rust/zerocopy/benches/transmute_ref_static_size.x86-64.mca
new file mode 100644
index 000000000..f297729c6
--- /dev/null
+++ b/rust/zerocopy/benches/transmute_ref_static_size.x86-64.mca
@@ -0,0 +1,43 @@
+Iterations: 100
+Instructions: 200
+Total Cycles: 104
+Total uOps: 200
+
+Dispatch Width: 4
+uOps Per Cycle: 1.92
+IPC: 1.92
+Block RThroughput: 1.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 0.49 0.50 - 1.01 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.49 0.50 - 0.01 - - mov rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_read_from_bytes.rs b/rust/zerocopy/benches/try_read_from_bytes.rs
new file mode 100644
index 000000000..f8384b32f
--- /dev/null
+++ b/rust/zerocopy/benches/try_read_from_bytes.rs
@@ -0,0 +1,7 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_read_from_bytes_static_size(source: &[u8]) -> Option<format::CocoPacket> {
+ zerocopy::TryFromBytes::try_read_from_bytes(source).ok()
+}
diff --git a/rust/zerocopy/benches/try_read_from_bytes.x86-64 b/rust/zerocopy/benches/try_read_from_bytes.x86-64
new file mode 100644
index 000000000..08088a08f
--- /dev/null
+++ b/rust/zerocopy/benches/try_read_from_bytes.x86-64
@@ -0,0 +1,23 @@
+bench_try_read_from_bytes_static_size:
+ mov ax, -16191
+ cmp rsi, 6
+ jne .LBB5_1
+ mov ecx, dword ptr [rdi]
+ movzx edx, cx
+ cmp edx, 49344
+ jne .LBB5_4
+ movzx eax, word ptr [rdi + 4]
+ shl rax, 32
+ or rcx, rax
+ shr rcx, 16
+ mov ax, -16192
+.LBB5_4:
+ shl rcx, 16
+ movzx eax, ax
+ or rax, rcx
+ ret
+.LBB5_1:
+ shl rcx, 16
+ movzx eax, ax
+ or rax, rcx
+ ret
diff --git a/rust/zerocopy/benches/try_read_from_bytes.x86-64.mca b/rust/zerocopy/benches/try_read_from_bytes.x86-64.mca
new file mode 100644
index 000000000..385e6a480
--- /dev/null
+++ b/rust/zerocopy/benches/try_read_from_bytes.x86-64.mca
@@ -0,0 +1,79 @@
+Iterations: 100
+Instructions: 2000
+Total Cycles: 608
+Total uOps: 2000
+
+Dispatch Width: 4
+uOps Per Cycle: 3.29
+IPC: 3.29
+Block RThroughput: 5.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov ax, -16191
+ 1 1 0.33 cmp rsi, 6
+ 1 1 1.00 jne .LBB5_1
+ 1 5 0.50 * mov ecx, dword ptr [rdi]
+ 1 1 0.33 movzx edx, cx
+ 1 1 0.33 cmp edx, 49344
+ 1 1 1.00 jne .LBB5_4
+ 1 5 0.50 * movzx eax, word ptr [rdi + 4]
+ 1 1 0.50 shl rax, 32
+ 1 1 0.33 or rcx, rax
+ 1 1 0.50 shr rcx, 16
+ 1 1 0.33 mov ax, -16192
+ 1 1 0.50 shl rcx, 16
+ 1 1 0.33 movzx eax, ax
+ 1 1 0.33 or rax, rcx
+ 1 1 1.00 U ret
+ 1 1 0.50 shl rcx, 16
+ 1 1 0.33 movzx eax, ax
+ 1 1 0.33 or rax, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 5.99 5.99 - 6.02 1.00 1.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - 0.99 - 0.01 - - mov ax, -16191
+ - - - 0.01 - 0.99 - - cmp rsi, 6
+ - - - - - 1.00 - - jne .LBB5_1
+ - - - - - - - 1.00 mov ecx, dword ptr [rdi]
+ - - 0.98 - - 0.02 - - movzx edx, cx
+ - - 0.99 0.01 - - - - cmp edx, 49344
+ - - - - - 1.00 - - jne .LBB5_4
+ - - - - - - 1.00 - movzx eax, word ptr [rdi + 4]
+ - - 0.01 - - 0.99 - - shl rax, 32
+ - - 0.02 0.98 - - - - or rcx, rax
+ - - 1.00 - - - - - shr rcx, 16
+ - - 0.99 0.01 - - - - mov ax, -16192
+ - - 1.00 - - - - - shl rcx, 16
+ - - - 1.00 - - - - movzx eax, ax
+ - - - 1.00 - - - - or rax, rcx
+ - - - - - 1.00 - - ret
+ - - 1.00 - - - - - shl rcx, 16
+ - - - 1.00 - - - - movzx eax, ax
+ - - - 0.99 - 0.01 - - or rax, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_read_from_prefix.rs b/rust/zerocopy/benches/try_read_from_prefix.rs
new file mode 100644
index 000000000..fabbac3bd
--- /dev/null
+++ b/rust/zerocopy/benches/try_read_from_prefix.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_read_from_prefix_static_size(source: &[u8]) -> Option<format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_read_from_prefix(source) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/try_read_from_prefix.x86-64 b/rust/zerocopy/benches/try_read_from_prefix.x86-64
new file mode 100644
index 000000000..d3e1edc3e
--- /dev/null
+++ b/rust/zerocopy/benches/try_read_from_prefix.x86-64
@@ -0,0 +1,16 @@
+bench_try_read_from_prefix_static_size:
+ mov eax, 49345
+ cmp rsi, 6
+ jb .LBB5_2
+ mov eax, dword ptr [rdi]
+ movzx ecx, word ptr [rdi + 4]
+ shl rcx, 32
+ or rcx, rax
+ movzx eax, cx
+ and rcx, -65536
+ or rcx, 49344
+ cmp eax, 49344
+ mov eax, 49345
+ cmove rax, rcx
+.LBB5_2:
+ ret
diff --git a/rust/zerocopy/benches/try_read_from_prefix.x86-64.mca b/rust/zerocopy/benches/try_read_from_prefix.x86-64.mca
new file mode 100644
index 000000000..40401d89e
--- /dev/null
+++ b/rust/zerocopy/benches/try_read_from_prefix.x86-64.mca
@@ -0,0 +1,67 @@
+Iterations: 100
+Instructions: 1400
+Total Cycles: 442
+Total uOps: 1500
+
+Dispatch Width: 4
+uOps Per Cycle: 3.39
+IPC: 3.17
+Block RThroughput: 3.8
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov eax, 49345
+ 1 1 0.33 cmp rsi, 6
+ 1 1 1.00 jb .LBB5_2
+ 1 5 0.50 * mov eax, dword ptr [rdi]
+ 1 5 0.50 * movzx ecx, word ptr [rdi + 4]
+ 1 1 0.50 shl rcx, 32
+ 1 1 0.33 or rcx, rax
+ 1 1 0.33 movzx eax, cx
+ 1 1 0.33 and rcx, -65536
+ 1 1 0.33 or rcx, 49344
+ 1 1 0.33 cmp eax, 49344
+ 1 1 0.33 mov eax, 49345
+ 2 2 0.67 cmove rax, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 4.33 4.33 - 4.34 1.00 1.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.65 0.01 - 0.34 - - mov eax, 49345
+ - - 0.01 0.33 - 0.66 - - cmp rsi, 6
+ - - - - - 1.00 - - jb .LBB5_2
+ - - - - - - - 1.00 mov eax, dword ptr [rdi]
+ - - - - - - 1.00 - movzx ecx, word ptr [rdi + 4]
+ - - 0.65 - - 0.35 - - shl rcx, 32
+ - - - 0.67 - 0.33 - - or rcx, rax
+ - - 0.01 0.99 - - - - movzx eax, cx
+ - - 0.99 0.01 - - - - and rcx, -65536
+ - - 0.01 0.99 - - - - or rcx, 49344
+ - - 0.99 0.01 - - - - cmp eax, 49344
+ - - 0.02 0.33 - 0.65 - - mov eax, 49345
+ - - 1.00 0.99 - 0.01 - - cmove rax, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_read_from_suffix.rs b/rust/zerocopy/benches/try_read_from_suffix.rs
new file mode 100644
index 000000000..1e961647b
--- /dev/null
+++ b/rust/zerocopy/benches/try_read_from_suffix.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_read_from_suffix_static_size(source: &[u8]) -> Option<format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_read_from_suffix(source) {
+ Ok((_rest, packet)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/try_read_from_suffix.x86-64 b/rust/zerocopy/benches/try_read_from_suffix.x86-64
new file mode 100644
index 000000000..095e326f0
--- /dev/null
+++ b/rust/zerocopy/benches/try_read_from_suffix.x86-64
@@ -0,0 +1,18 @@
+bench_try_read_from_suffix_static_size:
+ mov eax, 49345
+ cmp rsi, 6
+ jb .LBB5_2
+ mov eax, dword ptr [rdi + rsi - 6]
+ movzx ecx, word ptr [rdi + rsi - 2]
+ shl rcx, 32
+ or rcx, rax
+ movzx edx, cx
+ xor eax, eax
+ cmp edx, 49344
+ cmovne rcx, rsi
+ sete al
+ and rcx, -65536
+ xor rax, 49345
+ or rax, rcx
+.LBB5_2:
+ ret
diff --git a/rust/zerocopy/benches/try_read_from_suffix.x86-64.mca b/rust/zerocopy/benches/try_read_from_suffix.x86-64.mca
new file mode 100644
index 000000000..d3eaadbb8
--- /dev/null
+++ b/rust/zerocopy/benches/try_read_from_suffix.x86-64.mca
@@ -0,0 +1,71 @@
+Iterations: 100
+Instructions: 1600
+Total Cycles: 478
+Total uOps: 1700
+
+Dispatch Width: 4
+uOps Per Cycle: 3.56
+IPC: 3.35
+Block RThroughput: 4.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov eax, 49345
+ 1 1 0.33 cmp rsi, 6
+ 1 1 1.00 jb .LBB5_2
+ 1 5 0.50 * mov eax, dword ptr [rdi + rsi - 6]
+ 1 5 0.50 * movzx ecx, word ptr [rdi + rsi - 2]
+ 1 1 0.50 shl rcx, 32
+ 1 1 0.33 or rcx, rax
+ 1 1 0.33 movzx edx, cx
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp edx, 49344
+ 2 2 0.67 cmovne rcx, rsi
+ 1 1 0.50 sete al
+ 1 1 0.33 and rcx, -65536
+ 1 1 0.33 xor rax, 49345
+ 1 1 0.33 or rax, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 4.66 4.66 - 4.68 1.00 1.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.32 0.01 - 0.67 - - mov eax, 49345
+ - - 0.62 0.02 - 0.36 - - cmp rsi, 6
+ - - - - - 1.00 - - jb .LBB5_2
+ - - - - - - - 1.00 mov eax, dword ptr [rdi + rsi - 6]
+ - - - - - - 1.00 - movzx ecx, word ptr [rdi + rsi - 2]
+ - - 0.37 - - 0.63 - - shl rcx, 32
+ - - 0.99 0.01 - - - - or rcx, rax
+ - - 1.00 - - - - - movzx edx, cx
+ - - - - - - - - xor eax, eax
+ - - 0.35 0.64 - 0.01 - - cmp edx, 49344
+ - - 1.00 1.00 - - - - cmovne rcx, rsi
+ - - - - - 1.00 - - sete al
+ - - 0.01 0.99 - - - - and rcx, -65536
+ - - - 1.00 - - - - xor rax, 49345
+ - - - 0.99 - 0.01 - - or rax, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_dynamic_padding.rs b/rust/zerocopy/benches/try_ref_from_bytes_dynamic_padding.rs
new file mode 100644
index 000000000..126009cd7
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_dynamic_padding.rs
@@ -0,0 +1,7 @@
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_bytes_dynamic_padding(source: &[u8]) -> Option<&format::CocoPacket> {
+ zerocopy::TryFromBytes::try_ref_from_bytes(source).ok()
+}
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_dynamic_padding.x86-64 b/rust/zerocopy/benches/try_ref_from_bytes_dynamic_padding.x86-64
new file mode 100644
index 000000000..217c5fc61
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_dynamic_padding.x86-64
@@ -0,0 +1,24 @@
+bench_try_ref_from_bytes_dynamic_padding:
+ test dil, 3
+ jne .LBB5_4
+ movabs rax, 9223372036854775804
+ and rax, rsi
+ cmp rax, 9
+ jb .LBB5_4
+ add rax, -9
+ movabs rcx, -6148914691236517205
+ mul rcx
+ shr rdx
+ lea rax, [rdx + 2*rdx]
+ or rax, 3
+ add rax, 9
+ cmp rsi, rax
+ jne .LBB5_4
+ cmp word ptr [rdi], -16192
+ je .LBB5_5
+.LBB5_4:
+ xor edi, edi
+ mov rdx, rsi
+.LBB5_5:
+ mov rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/try_ref_from_bytes_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..95b993c7e
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_dynamic_padding.x86-64.mca
@@ -0,0 +1,81 @@
+Iterations: 100
+Instructions: 2100
+Total Cycles: 709
+Total uOps: 2300
+
+Dispatch Width: 4
+uOps Per Cycle: 3.24
+IPC: 2.96
+Block RThroughput: 5.8
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 test dil, 3
+ 1 1 1.00 jne .LBB5_4
+ 1 1 0.33 movabs rax, 9223372036854775804
+ 1 1 0.33 and rax, rsi
+ 1 1 0.33 cmp rax, 9
+ 1 1 1.00 jb .LBB5_4
+ 1 1 0.33 add rax, -9
+ 1 1 0.33 movabs rcx, -6148914691236517205
+ 2 4 1.00 mul rcx
+ 1 1 0.50 shr rdx
+ 1 1 0.50 lea rax, [rdx + 2*rdx]
+ 1 1 0.33 or rax, 3
+ 1 1 0.33 add rax, 9
+ 1 1 0.33 cmp rsi, rax
+ 1 1 1.00 jne .LBB5_4
+ 2 6 0.50 * cmp word ptr [rdi], -16192
+ 1 1 1.00 je .LBB5_5
+ 1 0 0.25 xor edi, edi
+ 1 1 0.33 mov rdx, rsi
+ 1 1 0.33 mov rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 6.98 6.99 - 7.03 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.48 0.51 - 0.01 - - test dil, 3
+ - - - - - 1.00 - - jne .LBB5_4
+ - - 0.51 0.49 - - - - movabs rax, 9223372036854775804
+ - - 0.01 0.99 - - - - and rax, rsi
+ - - 0.51 0.49 - - - - cmp rax, 9
+ - - - - - 1.00 - - jb .LBB5_4
+ - - 0.98 - - 0.02 - - add rax, -9
+ - - 0.98 0.02 - - - - movabs rcx, -6148914691236517205
+ - - 1.00 1.00 - - - - mul rcx
+ - - 0.99 - - 0.01 - - shr rdx
+ - - - 1.00 - - - - lea rax, [rdx + 2*rdx]
+ - - - 0.51 - 0.49 - - or rax, 3
+ - - 0.01 0.49 - 0.50 - - add rax, 9
+ - - - 0.02 - 0.98 - - cmp rsi, rax
+ - - - - - 1.00 - - jne .LBB5_4
+ - - 0.51 0.49 - - 0.50 0.50 cmp word ptr [rdi], -16192
+ - - - - - 1.00 - - je .LBB5_5
+ - - - - - - - - xor edi, edi
+ - - 0.50 0.50 - - - - mov rdx, rsi
+ - - 0.50 0.48 - 0.02 - - mov rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_dynamic_size.rs b/rust/zerocopy/benches/try_ref_from_bytes_dynamic_size.rs
new file mode 100644
index 000000000..fc3cfbae2
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_dynamic_size.rs
@@ -0,0 +1,7 @@
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_bytes_dynamic_size(source: &[u8]) -> Option<&format::CocoPacket> {
+ zerocopy::TryFromBytes::try_ref_from_bytes(source).ok()
+}
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_dynamic_size.x86-64 b/rust/zerocopy/benches/try_ref_from_bytes_dynamic_size.x86-64
new file mode 100644
index 000000000..cf67afd31
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_dynamic_size.x86-64
@@ -0,0 +1,22 @@
+bench_try_ref_from_bytes_dynamic_size:
+ mov rdx, rsi
+ mov rax, rdi
+ cmp rsi, 4
+ setb cl
+ or cl, al
+ test cl, 1
+ jne .LBB5_4
+ lea rcx, [rdx - 4]
+ mov rsi, rcx
+ and rsi, -2
+ add rsi, 4
+ cmp rdx, rsi
+ jne .LBB5_4
+ cmp word ptr [rax], -16192
+ jne .LBB5_4
+ shr rcx
+ mov rdx, rcx
+ ret
+.LBB5_4:
+ xor eax, eax
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_dynamic_size.x86-64.mca b/rust/zerocopy/benches/try_ref_from_bytes_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..ecd7a18f6
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_dynamic_size.x86-64.mca
@@ -0,0 +1,79 @@
+Iterations: 100
+Instructions: 2000
+Total Cycles: 639
+Total uOps: 2100
+
+Dispatch Width: 4
+uOps Per Cycle: 3.29
+IPC: 3.13
+Block RThroughput: 5.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rdx, rsi
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 cmp rsi, 4
+ 1 1 0.50 setb cl
+ 1 1 0.33 or cl, al
+ 1 1 0.33 test cl, 1
+ 1 1 1.00 jne .LBB5_4
+ 1 1 0.50 lea rcx, [rdx - 4]
+ 1 1 0.33 mov rsi, rcx
+ 1 1 0.33 and rsi, -2
+ 1 1 0.33 add rsi, 4
+ 1 1 0.33 cmp rdx, rsi
+ 1 1 1.00 jne .LBB5_4
+ 2 6 0.50 * cmp word ptr [rax], -16192
+ 1 1 1.00 jne .LBB5_4
+ 1 1 0.50 shr rcx
+ 1 1 0.33 mov rdx, rcx
+ 1 1 1.00 U ret
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 6.32 6.32 - 6.36 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.33 0.66 - 0.01 - - mov rdx, rsi
+ - - 0.66 0.34 - - - - mov rax, rdi
+ - - 0.34 0.66 - - - - cmp rsi, 4
+ - - 0.99 - - 0.01 - - setb cl
+ - - 0.01 0.99 - - - - or cl, al
+ - - - 1.00 - - - - test cl, 1
+ - - - - - 1.00 - - jne .LBB5_4
+ - - 0.66 0.34 - - - - lea rcx, [rdx - 4]
+ - - 0.33 0.66 - 0.01 - - mov rsi, rcx
+ - - 1.00 - - - - - and rsi, -2
+ - - 0.66 0.34 - - - - add rsi, 4
+ - - - 1.00 - - - - cmp rdx, rsi
+ - - - - - 1.00 - - jne .LBB5_4
+ - - - - - 1.00 0.50 0.50 cmp word ptr [rax], -16192
+ - - - - - 1.00 - - jne .LBB5_4
+ - - 0.67 - - 0.33 - - shr rcx
+ - - 0.67 0.33 - - - - mov rdx, rcx
+ - - - - - 1.00 - - ret
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_static_size.rs b/rust/zerocopy/benches/try_ref_from_bytes_static_size.rs
new file mode 100644
index 000000000..521557146
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_static_size.rs
@@ -0,0 +1,7 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_bytes_static_size(source: &[u8]) -> Option<&format::CocoPacket> {
+ zerocopy::TryFromBytes::try_ref_from_bytes(source).ok()
+}
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_static_size.x86-64 b/rust/zerocopy/benches/try_ref_from_bytes_static_size.x86-64
new file mode 100644
index 000000000..a11f27189
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_static_size.x86-64
@@ -0,0 +1,13 @@
+bench_try_ref_from_bytes_static_size:
+ mov rax, rdi
+ cmp rsi, 6
+ setne cl
+ or cl, al
+ test cl, 1
+ jne .LBB5_2
+ cmp word ptr [rax], -16192
+ je .LBB5_3
+.LBB5_2:
+ xor eax, eax
+.LBB5_3:
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_static_size.x86-64.mca b/rust/zerocopy/benches/try_ref_from_bytes_static_size.x86-64.mca
new file mode 100644
index 000000000..e6bd20533
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_static_size.x86-64.mca
@@ -0,0 +1,59 @@
+Iterations: 100
+Instructions: 1000
+Total Cycles: 308
+Total uOps: 1100
+
+Dispatch Width: 4
+uOps Per Cycle: 3.57
+IPC: 3.25
+Block RThroughput: 3.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 cmp rsi, 6
+ 1 1 0.50 setne cl
+ 1 1 0.33 or cl, al
+ 1 1 0.33 test cl, 1
+ 1 1 1.00 jne .LBB5_2
+ 2 6 0.50 * cmp word ptr [rax], -16192
+ 1 1 1.00 je .LBB5_3
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 2.98 2.98 - 3.04 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.02 0.97 - 0.01 - - mov rax, rdi
+ - - 0.02 0.98 - - - - cmp rsi, 6
+ - - 1.00 - - - - - setne cl
+ - - 0.97 0.02 - 0.01 - - or cl, al
+ - - 0.96 0.03 - 0.01 - - test cl, 1
+ - - - - - 1.00 - - jne .LBB5_2
+ - - 0.01 0.98 - 0.01 0.50 0.50 cmp word ptr [rax], -16192
+ - - - - - 1.00 - - je .LBB5_3
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_padding.rs b/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_padding.rs
new file mode 100644
index 000000000..8b9e7355e
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_padding.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_bytes_with_elems_dynamic_padding(
+ source: &[u8],
+ count: usize,
+) -> Option<&format::CocoPacket> {
+ zerocopy::TryFromBytes::try_ref_from_bytes_with_elems(source, count).ok()
+}
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_padding.x86-64 b/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_padding.x86-64
new file mode 100644
index 000000000..3ef8d1448
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_padding.x86-64
@@ -0,0 +1,21 @@
+bench_try_ref_from_bytes_with_elems_dynamic_padding:
+ movabs rax, 3074457345618258598
+ cmp rdx, rax
+ seta cl
+ mov rax, rdi
+ test al, 3
+ setne dil
+ or dil, cl
+ jne .LBB5_3
+ lea rcx, [rdx + 2*rdx]
+ or rcx, 3
+ add rcx, 9
+ cmp rsi, rcx
+ jne .LBB5_3
+ cmp word ptr [rax], -16192
+ je .LBB5_4
+.LBB5_3:
+ xor eax, eax
+ mov rdx, rsi
+.LBB5_4:
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..8131f3bd5
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_padding.x86-64.mca
@@ -0,0 +1,75 @@
+Iterations: 100
+Instructions: 1800
+Total Cycles: 607
+Total uOps: 2000
+
+Dispatch Width: 4
+uOps Per Cycle: 3.29
+IPC: 2.97
+Block RThroughput: 5.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movabs rax, 3074457345618258598
+ 1 1 0.33 cmp rdx, rax
+ 2 2 1.00 seta cl
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 test al, 3
+ 1 1 0.50 setne dil
+ 1 1 0.33 or dil, cl
+ 1 1 1.00 jne .LBB5_3
+ 1 1 0.50 lea rcx, [rdx + 2*rdx]
+ 1 1 0.33 or rcx, 3
+ 1 1 0.33 add rcx, 9
+ 1 1 0.33 cmp rsi, rcx
+ 1 1 1.00 jne .LBB5_3
+ 2 6 0.50 * cmp word ptr [rax], -16192
+ 1 1 1.00 je .LBB5_4
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 mov rdx, rsi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 5.99 5.99 - 6.02 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - 0.99 - 0.01 - - movabs rax, 3074457345618258598
+ - - - 1.00 - - - - cmp rdx, rax
+ - - - - - 2.00 - - seta cl
+ - - 1.00 - - - - - mov rax, rdi
+ - - 0.99 0.01 - - - - test al, 3
+ - - 1.00 - - - - - setne dil
+ - - - 0.99 - 0.01 - - or dil, cl
+ - - - - - 1.00 - - jne .LBB5_3
+ - - 0.01 0.99 - - - - lea rcx, [rdx + 2*rdx]
+ - - - 1.00 - - - - or rcx, 3
+ - - 0.99 0.01 - - - - add rcx, 9
+ - - - 1.00 - - - - cmp rsi, rcx
+ - - - - - 1.00 - - jne .LBB5_3
+ - - 1.00 - - - 0.50 0.50 cmp word ptr [rax], -16192
+ - - - - - 1.00 - - je .LBB5_4
+ - - - - - - - - xor eax, eax
+ - - 1.00 - - - - - mov rdx, rsi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_size.rs b/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_size.rs
new file mode 100644
index 000000000..9ccd6fef5
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_size.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_bytes_with_elems_dynamic_size(
+ source: &[u8],
+ count: usize,
+) -> Option<&format::CocoPacket> {
+ zerocopy::TryFromBytes::try_ref_from_bytes_with_elems(source, count).ok()
+}
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_size.x86-64 b/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_size.x86-64
new file mode 100644
index 000000000..ba34b1855
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_size.x86-64
@@ -0,0 +1,18 @@
+bench_try_ref_from_bytes_with_elems_dynamic_size:
+ movabs rax, 4611686018427387901
+ cmp rdx, rax
+ seta cl
+ mov rax, rdi
+ or dil, cl
+ test dil, 1
+ jne .LBB5_3
+ lea rcx, [2*rdx + 4]
+ cmp rsi, rcx
+ jne .LBB5_3
+ cmp word ptr [rax], -16192
+ je .LBB5_4
+.LBB5_3:
+ xor eax, eax
+ mov rdx, rsi
+.LBB5_4:
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_size.x86-64.mca b/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..ae049c03d
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_bytes_with_elems_dynamic_size.x86-64.mca
@@ -0,0 +1,69 @@
+Iterations: 100
+Instructions: 1500
+Total Cycles: 507
+Total uOps: 1700
+
+Dispatch Width: 4
+uOps Per Cycle: 3.35
+IPC: 2.96
+Block RThroughput: 4.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movabs rax, 4611686018427387901
+ 1 1 0.33 cmp rdx, rax
+ 2 2 1.00 seta cl
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 or dil, cl
+ 1 1 0.33 test dil, 1
+ 1 1 1.00 jne .LBB5_3
+ 1 1 0.50 lea rcx, [2*rdx + 4]
+ 1 1 0.33 cmp rsi, rcx
+ 1 1 1.00 jne .LBB5_3
+ 2 6 0.50 * cmp word ptr [rax], -16192
+ 1 1 1.00 je .LBB5_4
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 mov rdx, rsi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 4.98 4.99 - 5.03 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - 0.99 - 0.01 - - movabs rax, 4611686018427387901
+ - - 0.50 0.50 - - - - cmp rdx, rax
+ - - 1.96 - - 0.04 - - seta cl
+ - - 0.01 0.99 - - - - mov rax, rdi
+ - - 1.00 - - - - - or dil, cl
+ - - 0.99 0.01 - - - - test dil, 1
+ - - - - - 1.00 - - jne .LBB5_3
+ - - 0.01 0.99 - - - - lea rcx, [2*rdx + 4]
+ - - 0.02 0.49 - 0.49 - - cmp rsi, rcx
+ - - - - - 1.00 - - jne .LBB5_3
+ - - - 0.51 - 0.49 0.50 0.50 cmp word ptr [rax], -16192
+ - - - - - 1.00 - - je .LBB5_4
+ - - - - - - - - xor eax, eax
+ - - 0.49 0.51 - - - - mov rdx, rsi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_dynamic_padding.rs b/rust/zerocopy/benches/try_ref_from_prefix_dynamic_padding.rs
new file mode 100644
index 000000000..23b346f9c
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_dynamic_padding.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_prefix_dynamic_padding(source: &[u8]) -> Option<&format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_ref_from_prefix(source) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_dynamic_padding.x86-64 b/rust/zerocopy/benches/try_ref_from_prefix_dynamic_padding.x86-64
new file mode 100644
index 000000000..d832cb7ec
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_dynamic_padding.x86-64
@@ -0,0 +1,29 @@
+bench_try_ref_from_prefix_dynamic_padding:
+ xor edx, edx
+ mov eax, 0
+ test dil, 3
+ je .LBB5_1
+ ret
+.LBB5_1:
+ movabs rax, 9223372036854775804
+ and rsi, rax
+ cmp rsi, 9
+ jae .LBB5_3
+ mov edx, 1
+ xor eax, eax
+ ret
+.LBB5_3:
+ add rsi, -9
+ movabs rcx, -6148914691236517205
+ mov rax, rsi
+ mul rcx
+ mov rax, rdx
+ shr rax
+ movzx ecx, word ptr [rdi]
+ cmp cx, -16192
+ mov edx, 2
+ cmove rdx, rax
+ xor eax, eax
+ cmp ecx, 49344
+ cmove rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/try_ref_from_prefix_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..482112a39
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_dynamic_padding.x86-64.mca
@@ -0,0 +1,91 @@
+Iterations: 100
+Instructions: 2600
+Total Cycles: 843
+Total uOps: 2900
+
+Dispatch Width: 4
+uOps Per Cycle: 3.44
+IPC: 3.08
+Block RThroughput: 7.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 0 0.25 xor edx, edx
+ 1 1 0.33 mov eax, 0
+ 1 1 0.33 test dil, 3
+ 1 1 1.00 je .LBB5_1
+ 1 1 1.00 U ret
+ 1 1 0.33 movabs rax, 9223372036854775804
+ 1 1 0.33 and rsi, rax
+ 1 1 0.33 cmp rsi, 9
+ 1 1 1.00 jae .LBB5_3
+ 1 1 0.33 mov edx, 1
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+ 1 1 0.33 add rsi, -9
+ 1 1 0.33 movabs rcx, -6148914691236517205
+ 1 1 0.33 mov rax, rsi
+ 2 4 1.00 mul rcx
+ 1 1 0.33 mov rax, rdx
+ 1 1 0.50 shr rax
+ 1 5 0.50 * movzx ecx, word ptr [rdi]
+ 1 1 0.33 cmp cx, -16192
+ 1 1 0.33 mov edx, 2
+ 2 2 0.67 cmove rdx, rax
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp ecx, 49344
+ 2 2 0.67 cmove rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 8.33 8.33 - 8.34 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - - - - - xor edx, edx
+ - - 0.32 0.34 - 0.34 - - mov eax, 0
+ - - 0.34 0.33 - 0.33 - - test dil, 3
+ - - - - - 1.00 - - je .LBB5_1
+ - - - - - 1.00 - - ret
+ - - 0.35 0.65 - - - - movabs rax, 9223372036854775804
+ - - 0.96 0.03 - 0.01 - - and rsi, rax
+ - - 0.01 0.97 - 0.02 - - cmp rsi, 9
+ - - - - - 1.00 - - jae .LBB5_3
+ - - 0.67 0.01 - 0.32 - - mov edx, 1
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
+ - - 0.02 0.34 - 0.64 - - add rsi, -9
+ - - 0.33 0.66 - 0.01 - - movabs rcx, -6148914691236517205
+ - - 0.66 0.34 - - - - mov rax, rsi
+ - - 1.00 1.00 - - - - mul rcx
+ - - 0.01 0.99 - - - - mov rax, rdx
+ - - 0.99 - - 0.01 - - shr rax
+ - - - - - - 0.50 0.50 movzx ecx, word ptr [rdi]
+ - - 0.33 0.03 - 0.64 - - cmp cx, -16192
+ - - 0.01 0.31 - 0.68 - - mov edx, 2
+ - - 1.00 1.00 - - - - cmove rdx, rax
+ - - - - - - - - xor eax, eax
+ - - 0.33 0.33 - 0.34 - - cmp ecx, 49344
+ - - 1.00 1.00 - - - - cmove rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_dynamic_size.rs b/rust/zerocopy/benches/try_ref_from_prefix_dynamic_size.rs
new file mode 100644
index 000000000..41a466ec8
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_dynamic_size.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_prefix_dynamic_size(source: &[u8]) -> Option<&format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_ref_from_prefix(source) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_dynamic_size.x86-64 b/rust/zerocopy/benches/try_ref_from_prefix_dynamic_size.x86-64
new file mode 100644
index 000000000..be7f34b9f
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_dynamic_size.x86-64
@@ -0,0 +1,22 @@
+bench_try_ref_from_prefix_dynamic_size:
+ xor edx, edx
+ mov eax, 0
+ test dil, 1
+ jne .LBB5_4
+ cmp rsi, 4
+ jae .LBB5_3
+ mov edx, 1
+ xor eax, eax
+ ret
+.LBB5_3:
+ add rsi, -4
+ shr rsi
+ movzx ecx, word ptr [rdi]
+ cmp ecx, 49344
+ mov edx, 2
+ cmove rdx, rsi
+ xor eax, eax
+ cmp cx, -16192
+ cmove rax, rdi
+.LBB5_4:
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_dynamic_size.x86-64.mca b/rust/zerocopy/benches/try_ref_from_prefix_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..11706defe
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_dynamic_size.x86-64.mca
@@ -0,0 +1,77 @@
+Iterations: 100
+Instructions: 1900
+Total Cycles: 573
+Total uOps: 2100
+
+Dispatch Width: 4
+uOps Per Cycle: 3.66
+IPC: 3.32
+Block RThroughput: 5.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 0 0.25 xor edx, edx
+ 1 1 0.33 mov eax, 0
+ 1 1 0.33 test dil, 1
+ 1 1 1.00 jne .LBB5_4
+ 1 1 0.33 cmp rsi, 4
+ 1 1 1.00 jae .LBB5_3
+ 1 1 0.33 mov edx, 1
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+ 1 1 0.33 add rsi, -4
+ 1 1 0.50 shr rsi
+ 1 5 0.50 * movzx ecx, word ptr [rdi]
+ 1 1 0.33 cmp ecx, 49344
+ 1 1 0.33 mov edx, 2
+ 2 2 0.67 cmove rdx, rsi
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp cx, -16192
+ 2 2 0.67 cmove rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 5.66 5.67 - 5.67 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - - - - - xor edx, edx
+ - - 0.30 0.37 - 0.33 - - mov eax, 0
+ - - 0.35 0.32 - 0.33 - - test dil, 1
+ - - - - - 1.00 - - jne .LBB5_4
+ - - 0.32 0.33 - 0.35 - - cmp rsi, 4
+ - - - - - 1.00 - - jae .LBB5_3
+ - - 0.33 0.35 - 0.32 - - mov edx, 1
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
+ - - 0.34 0.64 - 0.02 - - add rsi, -4
+ - - 1.00 - - - - - shr rsi
+ - - - - - - 0.50 0.50 movzx ecx, word ptr [rdi]
+ - - 0.60 0.40 - - - - cmp ecx, 49344
+ - - 0.05 0.95 - - - - mov edx, 2
+ - - 1.00 1.00 - - - - cmove rdx, rsi
+ - - - - - - - - xor eax, eax
+ - - 0.37 0.31 - 0.32 - - cmp cx, -16192
+ - - 1.00 1.00 - - - - cmove rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_static_size.rs b/rust/zerocopy/benches/try_ref_from_prefix_static_size.rs
new file mode 100644
index 000000000..5f13d482b
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_static_size.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_prefix_static_size(source: &[u8]) -> Option<&format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_ref_from_prefix(source) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_static_size.x86-64 b/rust/zerocopy/benches/try_ref_from_prefix_static_size.x86-64
new file mode 100644
index 000000000..83212f776
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_static_size.x86-64
@@ -0,0 +1,15 @@
+bench_try_ref_from_prefix_static_size:
+ cmp rsi, 6
+ setb al
+ or al, dil
+ test al, 1
+ jne .LBB5_2
+ movzx eax, word ptr [rdi]
+ cmp eax, 49344
+ mov eax, 2
+ cmove rax, rdi
+ je .LBB5_3
+.LBB5_2:
+ xor eax, eax
+.LBB5_3:
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_static_size.x86-64.mca b/rust/zerocopy/benches/try_ref_from_prefix_static_size.x86-64.mca
new file mode 100644
index 000000000..5d02b863a
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_static_size.x86-64.mca
@@ -0,0 +1,63 @@
+Iterations: 100
+Instructions: 1200
+Total Cycles: 374
+Total uOps: 1300
+
+Dispatch Width: 4
+uOps Per Cycle: 3.48
+IPC: 3.21
+Block RThroughput: 3.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 cmp rsi, 6
+ 1 1 0.50 setb al
+ 1 1 0.33 or al, dil
+ 1 1 0.33 test al, 1
+ 1 1 1.00 jne .LBB5_2
+ 1 5 0.50 * movzx eax, word ptr [rdi]
+ 1 1 0.33 cmp eax, 49344
+ 1 1 0.33 mov eax, 2
+ 2 2 0.67 cmove rax, rdi
+ 1 1 1.00 je .LBB5_3
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 3.66 3.65 - 3.69 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.35 0.64 - 0.01 - - cmp rsi, 6
+ - - 1.00 - - - - - setb al
+ - - 0.02 0.66 - 0.32 - - or al, dil
+ - - 0.03 0.65 - 0.32 - - test al, 1
+ - - - - - 1.00 - - jne .LBB5_2
+ - - - - - - 0.50 0.50 movzx eax, word ptr [rdi]
+ - - 0.92 0.07 - 0.01 - - cmp eax, 49344
+ - - 0.37 0.63 - - - - mov eax, 2
+ - - 0.97 1.00 - 0.03 - - cmove rax, rdi
+ - - - - - 1.00 - - je .LBB5_3
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.rs b/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.rs
new file mode 100644
index 000000000..1744a4075
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.rs
@@ -0,0 +1,13 @@
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_prefix_with_elems_dynamic_padding(
+ source: &[u8],
+ count: usize,
+) -> Option<&format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_ref_from_prefix_with_elems(source, count) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.x86-64 b/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.x86-64
new file mode 100644
index 000000000..80e66ba16
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.x86-64
@@ -0,0 +1,30 @@
+bench_try_ref_from_prefix_with_elems_dynamic_padding:
+ movabs rax, 3074457345618258598
+ cmp rdx, rax
+ ja .LBB5_1
+ xor ecx, ecx
+ mov eax, 0
+ test dil, 3
+ je .LBB5_3
+ mov rdx, rcx
+ ret
+.LBB5_3:
+ lea rax, [rdx + 2*rdx]
+ or rax, 3
+ add rax, 9
+ cmp rax, rsi
+ jbe .LBB5_4
+.LBB5_1:
+ xor eax, eax
+ mov edx, 1
+ ret
+.LBB5_4:
+ movzx esi, word ptr [rdi]
+ cmp si, -16192
+ mov ecx, 2
+ cmove rcx, rdx
+ xor eax, eax
+ cmp esi, 49344
+ cmove rax, rdi
+ mov rdx, rcx
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..512e8ce64
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.x86-64.mca
@@ -0,0 +1,91 @@
+Iterations: 100
+Instructions: 2600
+Total Cycles: 806
+Total uOps: 2800
+
+Dispatch Width: 4
+uOps Per Cycle: 3.47
+IPC: 3.23
+Block RThroughput: 7.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movabs rax, 3074457345618258598
+ 1 1 0.33 cmp rdx, rax
+ 1 1 1.00 ja .LBB5_1
+ 1 0 0.25 xor ecx, ecx
+ 1 1 0.33 mov eax, 0
+ 1 1 0.33 test dil, 3
+ 1 1 1.00 je .LBB5_3
+ 1 1 0.33 mov rdx, rcx
+ 1 1 1.00 U ret
+ 1 1 0.50 lea rax, [rdx + 2*rdx]
+ 1 1 0.33 or rax, 3
+ 1 1 0.33 add rax, 9
+ 1 1 0.33 cmp rax, rsi
+ 1 1 1.00 jbe .LBB5_4
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 mov edx, 1
+ 1 1 1.00 U ret
+ 1 5 0.50 * movzx esi, word ptr [rdi]
+ 1 1 0.33 cmp si, -16192
+ 1 1 0.33 mov ecx, 2
+ 2 2 0.67 cmove rcx, rdx
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp esi, 49344
+ 2 2 0.67 cmove rax, rdi
+ 1 1 0.33 mov rdx, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 7.98 7.99 - 8.03 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.98 - - 0.02 - - movabs rax, 3074457345618258598
+ - - - 1.00 - - - - cmp rdx, rax
+ - - - - - 1.00 - - ja .LBB5_1
+ - - - - - - - - xor ecx, ecx
+ - - 0.99 0.01 - - - - mov eax, 0
+ - - 0.01 0.96 - 0.03 - - test dil, 3
+ - - - - - 1.00 - - je .LBB5_3
+ - - 0.97 0.01 - 0.02 - - mov rdx, rcx
+ - - - - - 1.00 - - ret
+ - - 0.03 0.97 - - - - lea rax, [rdx + 2*rdx]
+ - - 0.03 0.97 - - - - or rax, 3
+ - - 0.01 0.99 - - - - add rax, 9
+ - - - 1.00 - - - - cmp rax, rsi
+ - - - - - 1.00 - - jbe .LBB5_4
+ - - - - - - - - xor eax, eax
+ - - 0.98 0.01 - 0.01 - - mov edx, 1
+ - - - - - 1.00 - - ret
+ - - - - - - 0.50 0.50 movzx esi, word ptr [rdi]
+ - - 0.97 0.03 - - - - cmp si, -16192
+ - - 0.98 0.01 - 0.01 - - mov ecx, 2
+ - - 1.00 0.03 - 0.97 - - cmove rcx, rdx
+ - - - - - - - - xor eax, eax
+ - - 0.03 0.97 - - - - cmp esi, 49344
+ - - 1.00 1.00 - - - - cmove rax, rdi
+ - - - 0.03 - 0.97 - - mov rdx, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_size.rs b/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_size.rs
new file mode 100644
index 000000000..ed0f50941
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_size.rs
@@ -0,0 +1,13 @@
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_prefix_with_elems_dynamic_size(
+ source: &[u8],
+ count: usize,
+) -> Option<&format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_ref_from_prefix_with_elems(source, count) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_size.x86-64 b/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_size.x86-64
new file mode 100644
index 000000000..c12e87c13
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_size.x86-64
@@ -0,0 +1,26 @@
+bench_try_ref_from_prefix_with_elems_dynamic_size:
+ movabs rax, 4611686018427387901
+ cmp rdx, rax
+ ja .LBB5_1
+ mov rcx, rdx
+ xor edx, edx
+ mov eax, 0
+ test dil, 1
+ jne .LBB5_5
+ lea rax, [2*rcx + 4]
+ cmp rax, rsi
+ jbe .LBB5_4
+.LBB5_1:
+ xor eax, eax
+ mov edx, 1
+ ret
+.LBB5_4:
+ movzx esi, word ptr [rdi]
+ cmp si, -16192
+ mov edx, 2
+ cmove rdx, rcx
+ xor eax, eax
+ cmp esi, 49344
+ cmove rax, rdi
+.LBB5_5:
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_size.x86-64.mca b/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..6c3f1a1ec
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_size.x86-64.mca
@@ -0,0 +1,83 @@
+Iterations: 100
+Instructions: 2200
+Total Cycles: 674
+Total uOps: 2400
+
+Dispatch Width: 4
+uOps Per Cycle: 3.56
+IPC: 3.26
+Block RThroughput: 6.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movabs rax, 4611686018427387901
+ 1 1 0.33 cmp rdx, rax
+ 1 1 1.00 ja .LBB5_1
+ 1 1 0.33 mov rcx, rdx
+ 1 0 0.25 xor edx, edx
+ 1 1 0.33 mov eax, 0
+ 1 1 0.33 test dil, 1
+ 1 1 1.00 jne .LBB5_5
+ 1 1 0.50 lea rax, [2*rcx + 4]
+ 1 1 0.33 cmp rax, rsi
+ 1 1 1.00 jbe .LBB5_4
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 mov edx, 1
+ 1 1 1.00 U ret
+ 1 5 0.50 * movzx esi, word ptr [rdi]
+ 1 1 0.33 cmp si, -16192
+ 1 1 0.33 mov edx, 2
+ 2 2 0.67 cmove rdx, rcx
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp esi, 49344
+ 2 2 0.67 cmove rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 6.65 6.66 - 6.69 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.66 0.33 - 0.01 - - movabs rax, 4611686018427387901
+ - - 0.02 0.66 - 0.32 - - cmp rdx, rax
+ - - - - - 1.00 - - ja .LBB5_1
+ - - 0.66 0.33 - 0.01 - - mov rcx, rdx
+ - - - - - - - - xor edx, edx
+ - - 0.33 0.01 - 0.66 - - mov eax, 0
+ - - 0.34 0.65 - 0.01 - - test dil, 1
+ - - - - - 1.00 - - jne .LBB5_5
+ - - 0.65 0.35 - - - - lea rax, [2*rcx + 4]
+ - - - 1.00 - - - - cmp rax, rsi
+ - - - - - 1.00 - - jbe .LBB5_4
+ - - - - - - - - xor eax, eax
+ - - 0.34 0.01 - 0.65 - - mov edx, 1
+ - - - - - 1.00 - - ret
+ - - - - - - 0.50 0.50 movzx esi, word ptr [rdi]
+ - - 0.65 0.34 - 0.01 - - cmp si, -16192
+ - - 0.66 0.34 - - - - mov edx, 2
+ - - 1.00 0.99 - 0.01 - - cmove rdx, rcx
+ - - - - - - - - xor eax, eax
+ - - 0.34 0.66 - - - - cmp esi, 49344
+ - - 1.00 0.99 - 0.01 - - cmove rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_dynamic_padding.rs b/rust/zerocopy/benches/try_ref_from_suffix_dynamic_padding.rs
new file mode 100644
index 000000000..981feca3c
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_dynamic_padding.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_suffix_dynamic_padding(source: &[u8]) -> Option<&format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_ref_from_suffix(source) {
+ Ok((_rest, packet)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_dynamic_padding.x86-64 b/rust/zerocopy/benches/try_ref_from_suffix_dynamic_padding.x86-64
new file mode 100644
index 000000000..b3e924442
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_dynamic_padding.x86-64
@@ -0,0 +1,26 @@
+bench_try_ref_from_suffix_dynamic_padding:
+ lea eax, [rsi + rdi]
+ test al, 3
+ jne .LBB5_1
+ movabs rax, 9223372036854775804
+ and rax, rsi
+ cmp rax, 9
+ jae .LBB5_3
+.LBB5_1:
+ xor eax, eax
+ ret
+.LBB5_3:
+ add rax, -9
+ movabs rcx, -6148914691236517205
+ mul rcx
+ shr rdx
+ lea rcx, [rdx + 2*rdx]
+ sub rsi, rcx
+ or rcx, -4
+ add rsi, rdi
+ lea rdi, [rcx + rsi]
+ add rdi, -8
+ xor eax, eax
+ cmp word ptr [rcx + rsi - 8], -16192
+ cmove rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/try_ref_from_suffix_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..d56ae56d8
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_dynamic_padding.x86-64.mca
@@ -0,0 +1,85 @@
+Iterations: 100
+Instructions: 2300
+Total Cycles: 791
+Total uOps: 2600
+
+Dispatch Width: 4
+uOps Per Cycle: 3.29
+IPC: 2.91
+Block RThroughput: 6.5
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.50 lea eax, [rsi + rdi]
+ 1 1 0.33 test al, 3
+ 1 1 1.00 jne .LBB5_1
+ 1 1 0.33 movabs rax, 9223372036854775804
+ 1 1 0.33 and rax, rsi
+ 1 1 0.33 cmp rax, 9
+ 1 1 1.00 jae .LBB5_3
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+ 1 1 0.33 add rax, -9
+ 1 1 0.33 movabs rcx, -6148914691236517205
+ 2 4 1.00 mul rcx
+ 1 1 0.50 shr rdx
+ 1 1 0.50 lea rcx, [rdx + 2*rdx]
+ 1 1 0.33 sub rsi, rcx
+ 1 1 0.33 or rcx, -4
+ 1 1 0.33 add rsi, rdi
+ 1 1 0.50 lea rdi, [rcx + rsi]
+ 1 1 0.33 add rdi, -8
+ 1 0 0.25 xor eax, eax
+ 2 6 0.50 * cmp word ptr [rcx + rsi - 8], -16192
+ 2 2 0.67 cmove rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 7.70 7.58 - 7.72 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.26 0.74 - - - - lea eax, [rsi + rdi]
+ - - 0.19 0.28 - 0.53 - - test al, 3
+ - - - - - 1.00 - - jne .LBB5_1
+ - - 0.93 0.06 - 0.01 - - movabs rax, 9223372036854775804
+ - - 0.81 0.14 - 0.05 - - and rax, rsi
+ - - 0.55 0.43 - 0.02 - - cmp rax, 9
+ - - - - - 1.00 - - jae .LBB5_3
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
+ - - 0.42 0.56 - 0.02 - - add rax, -9
+ - - 0.67 0.30 - 0.03 - - movabs rcx, -6148914691236517205
+ - - 1.00 1.00 - - - - mul rcx
+ - - 0.71 - - 0.29 - - shr rdx
+ - - 0.32 0.68 - - - - lea rcx, [rdx + 2*rdx]
+ - - 0.57 0.04 - 0.39 - - sub rsi, rcx
+ - - 0.28 0.67 - 0.05 - - or rcx, -4
+ - - 0.29 0.29 - 0.42 - - add rsi, rdi
+ - - 0.02 0.98 - - - - lea rdi, [rcx + rsi]
+ - - 0.02 0.41 - 0.57 - - add rdi, -8
+ - - - - - - - - xor eax, eax
+ - - 0.57 0.01 - 0.42 0.50 0.50 cmp word ptr [rcx + rsi - 8], -16192
+ - - 0.09 0.99 - 0.92 - - cmove rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_dynamic_size.rs b/rust/zerocopy/benches/try_ref_from_suffix_dynamic_size.rs
new file mode 100644
index 000000000..c3d75ac9b
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_dynamic_size.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_suffix_dynamic_size(source: &[u8]) -> Option<&format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_ref_from_suffix(source) {
+ Ok((_rest, packet)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_dynamic_size.x86-64 b/rust/zerocopy/benches/try_ref_from_suffix_dynamic_size.x86-64
new file mode 100644
index 000000000..d51f7817e
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_dynamic_size.x86-64
@@ -0,0 +1,18 @@
+bench_try_ref_from_suffix_dynamic_size:
+ lea eax, [rsi + rdi]
+ cmp rsi, 4
+ setb cl
+ or cl, al
+ test cl, 1
+ je .LBB5_2
+ xor eax, eax
+ ret
+.LBB5_2:
+ lea rdx, [rsi - 4]
+ shr rdx
+ and esi, 1
+ lea rcx, [rdi + rsi]
+ xor eax, eax
+ cmp word ptr [rdi + rsi], -16192
+ cmove rax, rcx
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_dynamic_size.x86-64.mca b/rust/zerocopy/benches/try_ref_from_suffix_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..6cf7f8e49
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_dynamic_size.x86-64.mca
@@ -0,0 +1,71 @@
+Iterations: 100
+Instructions: 1600
+Total Cycles: 510
+Total uOps: 1800
+
+Dispatch Width: 4
+uOps Per Cycle: 3.53
+IPC: 3.14
+Block RThroughput: 4.5
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.50 lea eax, [rsi + rdi]
+ 1 1 0.33 cmp rsi, 4
+ 1 1 0.50 setb cl
+ 1 1 0.33 or cl, al
+ 1 1 0.33 test cl, 1
+ 1 1 1.00 je .LBB5_2
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+ 1 1 0.50 lea rdx, [rsi - 4]
+ 1 1 0.50 shr rdx
+ 1 1 0.33 and esi, 1
+ 1 1 0.50 lea rcx, [rdi + rsi]
+ 1 0 0.25 xor eax, eax
+ 2 6 0.50 * cmp word ptr [rdi + rsi], -16192
+ 2 2 0.67 cmove rax, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 4.99 5.00 - 5.01 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.98 0.02 - - - - lea eax, [rsi + rdi]
+ - - - 0.98 - 0.02 - - cmp rsi, 4
+ - - 1.00 - - - - - setb cl
+ - - 0.01 0.99 - - - - or cl, al
+ - - 0.01 0.07 - 0.92 - - test cl, 1
+ - - - - - 1.00 - - je .LBB5_2
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
+ - - 0.93 0.07 - - - - lea rdx, [rsi - 4]
+ - - 0.93 - - 0.07 - - shr rdx
+ - - 0.06 0.93 - 0.01 - - and esi, 1
+ - - 0.07 0.93 - - - - lea rcx, [rdi + rsi]
+ - - - - - - - - xor eax, eax
+ - - - 0.01 - 0.99 0.50 0.50 cmp word ptr [rdi + rsi], -16192
+ - - 1.00 1.00 - - - - cmove rax, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_static_size.rs b/rust/zerocopy/benches/try_ref_from_suffix_static_size.rs
new file mode 100644
index 000000000..d4b92f639
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_static_size.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_suffix_static_size(source: &[u8]) -> Option<&format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_ref_from_suffix(source) {
+ Ok((_rest, packet)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_static_size.x86-64 b/rust/zerocopy/benches/try_ref_from_suffix_static_size.x86-64
new file mode 100644
index 000000000..cd39f7093
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_static_size.x86-64
@@ -0,0 +1,16 @@
+bench_try_ref_from_suffix_static_size:
+ lea eax, [rsi + rdi]
+ cmp rsi, 6
+ setb cl
+ or cl, al
+ test cl, 1
+ je .LBB5_2
+ xor eax, eax
+ ret
+.LBB5_2:
+ lea rcx, [rdi + rsi]
+ add rcx, -6
+ xor eax, eax
+ cmp word ptr [rdi + rsi - 6], -16192
+ cmove rax, rcx
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_static_size.x86-64.mca b/rust/zerocopy/benches/try_ref_from_suffix_static_size.x86-64.mca
new file mode 100644
index 000000000..087d1e7ed
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_static_size.x86-64.mca
@@ -0,0 +1,67 @@
+Iterations: 100
+Instructions: 1400
+Total Cycles: 443
+Total uOps: 1600
+
+Dispatch Width: 4
+uOps Per Cycle: 3.61
+IPC: 3.16
+Block RThroughput: 4.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.50 lea eax, [rsi + rdi]
+ 1 1 0.33 cmp rsi, 6
+ 1 1 0.50 setb cl
+ 1 1 0.33 or cl, al
+ 1 1 0.33 test cl, 1
+ 1 1 1.00 je .LBB5_2
+ 1 0 0.25 xor eax, eax
+ 1 1 1.00 U ret
+ 1 1 0.50 lea rcx, [rdi + rsi]
+ 1 1 0.33 add rcx, -6
+ 1 0 0.25 xor eax, eax
+ 2 6 0.50 * cmp word ptr [rdi + rsi - 6], -16192
+ 2 2 0.67 cmove rax, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 4.33 4.33 - 4.34 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.32 0.68 - - - - lea eax, [rsi + rdi]
+ - - 0.05 0.94 - 0.01 - - cmp rsi, 6
+ - - 1.00 - - - - - setb cl
+ - - 0.95 0.05 - - - - or cl, al
+ - - 0.95 0.02 - 0.03 - - test cl, 1
+ - - - - - 1.00 - - je .LBB5_2
+ - - - - - - - - xor eax, eax
+ - - - - - 1.00 - - ret
+ - - 0.04 0.96 - - - - lea rcx, [rdi + rsi]
+ - - 0.02 0.97 - 0.01 - - add rcx, -6
+ - - - - - - - - xor eax, eax
+ - - 0.03 0.66 - 0.31 0.50 0.50 cmp word ptr [rdi + rsi - 6], -16192
+ - - 0.97 0.05 - 0.98 - - cmove rax, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_padding.rs b/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_padding.rs
new file mode 100644
index 000000000..1da455c9a
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_padding.rs
@@ -0,0 +1,13 @@
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_suffix_with_elems_dynamic_padding(
+ source: &[u8],
+ count: usize,
+) -> Option<&format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_ref_from_suffix_with_elems(source, count) {
+ Ok((_rest, packet)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_padding.x86-64 b/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_padding.x86-64
new file mode 100644
index 000000000..c7530d8b6
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_padding.x86-64
@@ -0,0 +1,32 @@
+bench_try_ref_from_suffix_with_elems_dynamic_padding:
+ movabs rax, 3074457345618258598
+ cmp rdx, rax
+ ja .LBB5_1
+ lea r8d, [rsi + rdi]
+ xor ecx, ecx
+ mov eax, 0
+ test r8b, 3
+ je .LBB5_3
+ mov rdx, rcx
+ ret
+.LBB5_3:
+ lea rax, [rdx + 2*rdx]
+ or rax, 3
+ add rax, 9
+ sub rsi, rax
+ jae .LBB5_4
+.LBB5_1:
+ xor eax, eax
+ mov edx, 1
+ ret
+.LBB5_4:
+ lea r8, [rdi + rsi]
+ movzx esi, word ptr [rdi + rsi]
+ cmp si, -16192
+ mov ecx, 2
+ cmove rcx, rdx
+ xor eax, eax
+ cmp esi, 49344
+ cmove rax, r8
+ mov rdx, rcx
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..be736c00c
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_padding.x86-64.mca
@@ -0,0 +1,95 @@
+Iterations: 100
+Instructions: 2800
+Total Cycles: 878
+Total uOps: 3000
+
+Dispatch Width: 4
+uOps Per Cycle: 3.42
+IPC: 3.19
+Block RThroughput: 7.5
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movabs rax, 3074457345618258598
+ 1 1 0.33 cmp rdx, rax
+ 1 1 1.00 ja .LBB5_1
+ 1 1 0.50 lea r8d, [rsi + rdi]
+ 1 0 0.25 xor ecx, ecx
+ 1 1 0.33 mov eax, 0
+ 1 1 0.33 test r8b, 3
+ 1 1 1.00 je .LBB5_3
+ 1 1 0.33 mov rdx, rcx
+ 1 1 1.00 U ret
+ 1 1 0.50 lea rax, [rdx + 2*rdx]
+ 1 1 0.33 or rax, 3
+ 1 1 0.33 add rax, 9
+ 1 1 0.33 sub rsi, rax
+ 1 1 1.00 jae .LBB5_4
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 mov edx, 1
+ 1 1 1.00 U ret
+ 1 1 0.50 lea r8, [rdi + rsi]
+ 1 5 0.50 * movzx esi, word ptr [rdi + rsi]
+ 1 1 0.33 cmp si, -16192
+ 1 1 0.33 mov ecx, 2
+ 2 2 0.67 cmove rcx, rdx
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp esi, 49344
+ 2 2 0.67 cmove rax, r8
+ 1 1 0.33 mov rdx, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 8.65 8.65 - 8.70 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.67 0.30 - 0.03 - - movabs rax, 3074457345618258598
+ - - 0.01 0.99 - - - - cmp rdx, rax
+ - - - - - 1.00 - - ja .LBB5_1
+ - - 0.99 0.01 - - - - lea r8d, [rsi + rdi]
+ - - - - - - - - xor ecx, ecx
+ - - 0.35 0.62 - 0.03 - - mov eax, 0
+ - - 0.99 0.01 - - - - test r8b, 3
+ - - - - - 1.00 - - je .LBB5_3
+ - - 0.68 0.30 - 0.02 - - mov rdx, rcx
+ - - - - - 1.00 - - ret
+ - - 0.07 0.93 - - - - lea rax, [rdx + 2*rdx]
+ - - 0.06 0.35 - 0.59 - - or rax, 3
+ - - 0.02 0.07 - 0.91 - - add rax, 9
+ - - 0.01 0.04 - 0.95 - - sub rsi, rax
+ - - - - - 1.00 - - jae .LBB5_4
+ - - - - - - - - xor eax, eax
+ - - 0.92 0.01 - 0.07 - - mov edx, 1
+ - - - - - 1.00 - - ret
+ - - - 1.00 - - - - lea r8, [rdi + rsi]
+ - - - - - - 0.50 0.50 movzx esi, word ptr [rdi + rsi]
+ - - 0.01 0.99 - - - - cmp si, -16192
+ - - 0.88 0.04 - 0.08 - - mov ecx, 2
+ - - 1.00 0.99 - 0.01 - - cmove rcx, rdx
+ - - - - - - - - xor eax, eax
+ - - 0.99 0.01 - - - - cmp esi, 49344
+ - - 1.00 1.00 - - - - cmove rax, r8
+ - - - 0.99 - 0.01 - - mov rdx, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_size.rs b/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_size.rs
new file mode 100644
index 000000000..8c2b80f87
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_size.rs
@@ -0,0 +1,13 @@
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_ref_from_suffix_with_elems_dynamic_size(
+ source: &[u8],
+ count: usize,
+) -> Option<&format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_ref_from_suffix_with_elems(source, count) {
+ Ok((_rest, packet)) => Some(packet),
+ _ => None,
+ }
+}
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_size.x86-64 b/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_size.x86-64
new file mode 100644
index 000000000..952eb12de
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_size.x86-64
@@ -0,0 +1,28 @@
+bench_try_ref_from_suffix_with_elems_dynamic_size:
+ movabs rax, 4611686018427387901
+ cmp rdx, rax
+ ja .LBB5_1
+ lea r8d, [rsi + rdi]
+ xor ecx, ecx
+ mov eax, 0
+ test r8b, 1
+ jne .LBB5_5
+ lea rax, [2*rdx + 4]
+ sub rsi, rax
+ jae .LBB5_4
+.LBB5_1:
+ xor eax, eax
+ mov edx, 1
+ ret
+.LBB5_4:
+ lea r8, [rdi + rsi]
+ movzx esi, word ptr [rdi + rsi]
+ cmp si, -16192
+ mov ecx, 2
+ cmove rcx, rdx
+ xor eax, eax
+ cmp esi, 49344
+ cmove rax, r8
+.LBB5_5:
+ mov rdx, rcx
+ ret
diff --git a/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_size.x86-64.mca b/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..d4f78f67a
--- /dev/null
+++ b/rust/zerocopy/benches/try_ref_from_suffix_with_elems_dynamic_size.x86-64.mca
@@ -0,0 +1,87 @@
+Iterations: 100
+Instructions: 2400
+Total Cycles: 1107
+Total uOps: 2600
+
+Dispatch Width: 4
+uOps Per Cycle: 2.35
+IPC: 2.17
+Block RThroughput: 6.5
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movabs rax, 4611686018427387901
+ 1 1 0.33 cmp rdx, rax
+ 1 1 1.00 ja .LBB5_1
+ 1 1 0.50 lea r8d, [rsi + rdi]
+ 1 0 0.25 xor ecx, ecx
+ 1 1 0.33 mov eax, 0
+ 1 1 0.33 test r8b, 1
+ 1 1 1.00 jne .LBB5_5
+ 1 1 0.50 lea rax, [2*rdx + 4]
+ 1 1 0.33 sub rsi, rax
+ 1 1 1.00 jae .LBB5_4
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 mov edx, 1
+ 1 1 1.00 U ret
+ 1 1 0.50 lea r8, [rdi + rsi]
+ 1 5 0.50 * movzx esi, word ptr [rdi + rsi]
+ 1 1 0.33 cmp si, -16192
+ 1 1 0.33 mov ecx, 2
+ 2 2 0.67 cmove rcx, rdx
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp esi, 49344
+ 2 2 0.67 cmove rax, r8
+ 1 1 0.33 mov rdx, rcx
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 6.99 7.00 - 8.01 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.02 0.95 - 0.03 - - movabs rax, 4611686018427387901
+ - - 0.93 0.04 - 0.03 - - cmp rdx, rax
+ - - - - - 1.00 - - ja .LBB5_1
+ - - 0.96 0.04 - - - - lea r8d, [rsi + rdi]
+ - - - - - - - - xor ecx, ecx
+ - - 0.95 0.02 - 0.03 - - mov eax, 0
+ - - 0.95 0.05 - - - - test r8b, 1
+ - - - - - 1.00 - - jne .LBB5_5
+ - - 0.06 0.94 - - - - lea rax, [2*rdx + 4]
+ - - 0.93 0.07 - - - - sub rsi, rax
+ - - - - - 1.00 - - jae .LBB5_4
+ - - - - - - - - xor eax, eax
+ - - 0.03 0.95 - 0.02 - - mov edx, 1
+ - - - - - 1.00 - - ret
+ - - 0.97 0.03 - - - - lea r8, [rdi + rsi]
+ - - - - - - 0.50 0.50 movzx esi, word ptr [rdi + rsi]
+ - - 0.03 0.97 - - - - cmp si, -16192
+ - - 0.05 0.94 - 0.01 - - mov ecx, 2
+ - - 0.06 0.98 - 0.96 - - cmove rcx, rdx
+ - - - - - - - - xor eax, eax
+ - - 0.97 0.03 - - - - cmp esi, 49344
+ - - 0.06 0.96 - 0.98 - - cmove rax, r8
+ - - 0.02 0.03 - 0.95 - - mov rdx, rcx
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_transmute.rs b/rust/zerocopy/benches/try_transmute.rs
new file mode 100644
index 000000000..c0de07a8d
--- /dev/null
+++ b/rust/zerocopy/benches/try_transmute.rs
@@ -0,0 +1,16 @@
+use zerocopy::Unalign;
+use zerocopy_derive::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[derive(IntoBytes, KnownLayout, Immutable)]
+#[repr(C)]
+struct MinimalViableSource {
+ bytes: [u8; 6],
+}
+
+#[unsafe(no_mangle)]
+fn bench_try_transmute(source: MinimalViableSource) -> Option<Unalign<format::CocoPacket>> {
+ zerocopy::try_transmute!(source).ok()
+}
diff --git a/rust/zerocopy/benches/try_transmute.x86-64 b/rust/zerocopy/benches/try_transmute.x86-64
new file mode 100644
index 000000000..9e16a6632
--- /dev/null
+++ b/rust/zerocopy/benches/try_transmute.x86-64
@@ -0,0 +1,9 @@
+bench_try_transmute:
+ movzx ecx, di
+ xor eax, eax
+ cmp ecx, 49344
+ sete al
+ and rdi, -65536
+ xor rax, 49345
+ or rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/try_transmute.x86-64.mca b/rust/zerocopy/benches/try_transmute.x86-64.mca
new file mode 100644
index 000000000..33abc3bf3
--- /dev/null
+++ b/rust/zerocopy/benches/try_transmute.x86-64.mca
@@ -0,0 +1,55 @@
+Iterations: 100
+Instructions: 800
+Total Cycles: 238
+Total uOps: 800
+
+Dispatch Width: 4
+uOps Per Cycle: 3.36
+IPC: 3.36
+Block RThroughput: 2.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 movzx ecx, di
+ 1 0 0.25 xor eax, eax
+ 1 1 0.33 cmp ecx, 49344
+ 1 1 0.50 sete al
+ 1 1 0.33 and rdi, -65536
+ 1 1 0.33 xor rax, 49345
+ 1 1 0.33 or rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 2.33 2.33 - 2.34 - -
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.32 0.67 - 0.01 - - movzx ecx, di
+ - - - - - - - - xor eax, eax
+ - - 0.33 0.67 - - - - cmp ecx, 49344
+ - - 1.00 - - - - - sete al
+ - - 0.67 0.33 - - - - and rdi, -65536
+ - - - 0.66 - 0.34 - - xor rax, 49345
+ - - 0.01 - - 0.99 - - or rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_transmute_ref_dynamic_size.rs b/rust/zerocopy/benches/try_transmute_ref_dynamic_size.rs
new file mode 100644
index 000000000..c9236e13d
--- /dev/null
+++ b/rust/zerocopy/benches/try_transmute_ref_dynamic_size.rs
@@ -0,0 +1,18 @@
+use zerocopy_derive::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[derive(IntoBytes, KnownLayout, Immutable)]
+#[repr(C, align(2))]
+struct MinimalViableSource {
+ header: [u8; 6],
+ trailer: [[u8; 2]],
+}
+
+#[unsafe(no_mangle)]
+fn bench_try_transmute_ref_dynamic_size(
+ source: &MinimalViableSource,
+) -> Option<&format::CocoPacket> {
+ zerocopy::try_transmute_ref!(source).ok()
+}
diff --git a/rust/zerocopy/benches/try_transmute_ref_dynamic_size.x86-64 b/rust/zerocopy/benches/try_transmute_ref_dynamic_size.x86-64
new file mode 100644
index 000000000..d34d2b3eb
--- /dev/null
+++ b/rust/zerocopy/benches/try_transmute_ref_dynamic_size.x86-64
@@ -0,0 +1,6 @@
+bench_try_transmute_ref_dynamic_size:
+ lea rdx, [rsi + 1]
+ xor eax, eax
+ cmp word ptr [rdi], -16192
+ cmove rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/try_transmute_ref_dynamic_size.x86-64.mca b/rust/zerocopy/benches/try_transmute_ref_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..bc771b504
--- /dev/null
+++ b/rust/zerocopy/benches/try_transmute_ref_dynamic_size.x86-64.mca
@@ -0,0 +1,49 @@
+Iterations: 100
+Instructions: 500
+Total Cycles: 209
+Total uOps: 700
+
+Dispatch Width: 4
+uOps Per Cycle: 3.35
+IPC: 2.39
+Block RThroughput: 1.8
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.50 lea rdx, [rsi + 1]
+ 1 0 0.25 xor eax, eax
+ 2 6 0.50 * cmp word ptr [rdi], -16192
+ 2 2 0.67 cmove rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 1.50 1.51 - 1.99 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.51 0.49 - - - - lea rdx, [rsi + 1]
+ - - - - - - - - xor eax, eax
+ - - - 0.02 - 0.98 0.50 0.50 cmp word ptr [rdi], -16192
+ - - 0.99 1.00 - 0.01 - - cmove rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/try_transmute_ref_static_size.rs b/rust/zerocopy/benches/try_transmute_ref_static_size.rs
new file mode 100644
index 000000000..631cce2b0
--- /dev/null
+++ b/rust/zerocopy/benches/try_transmute_ref_static_size.rs
@@ -0,0 +1,17 @@
+use zerocopy_derive::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[derive(IntoBytes, KnownLayout, Immutable)]
+#[repr(C, align(2))]
+struct MinimalViableSource {
+ bytes: [u8; 6],
+}
+
+#[unsafe(no_mangle)]
+fn bench_try_transmute_ref_static_size(
+ source: &MinimalViableSource,
+) -> Option<&format::CocoPacket> {
+ zerocopy::try_transmute_ref!(source).ok()
+}
diff --git a/rust/zerocopy/benches/try_transmute_ref_static_size.x86-64 b/rust/zerocopy/benches/try_transmute_ref_static_size.x86-64
new file mode 100644
index 000000000..8c16face9
--- /dev/null
+++ b/rust/zerocopy/benches/try_transmute_ref_static_size.x86-64
@@ -0,0 +1,5 @@
+bench_try_transmute_ref_static_size:
+ xor eax, eax
+ cmp word ptr [rdi], -16192
+ cmove rax, rdi
+ ret
diff --git a/rust/zerocopy/benches/try_transmute_ref_static_size.x86-64.mca b/rust/zerocopy/benches/try_transmute_ref_static_size.x86-64.mca
new file mode 100644
index 000000000..cf7384989
--- /dev/null
+++ b/rust/zerocopy/benches/try_transmute_ref_static_size.x86-64.mca
@@ -0,0 +1,47 @@
+Iterations: 100
+Instructions: 400
+Total Cycles: 160
+Total uOps: 600
+
+Dispatch Width: 4
+uOps Per Cycle: 3.75
+IPC: 2.50
+Block RThroughput: 1.5
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 0 0.25 xor eax, eax
+ 2 6 0.50 * cmp word ptr [rdi], -16192
+ 2 2 0.67 cmove rax, rdi
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 1.02 1.48 - 1.50 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - - - - - xor eax, eax
+ - - 0.02 0.49 - 0.49 0.50 0.50 cmp word ptr [rdi], -16192
+ - - 1.00 0.99 - 0.01 - - cmove rax, rdi
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/write_to_dynamic_size.rs b/rust/zerocopy/benches/write_to_dynamic_size.rs
new file mode 100644
index 000000000..c126a1468
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_dynamic_size.rs
@@ -0,0 +1,9 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_write_to_dynamic_size(source: &format::CocoPacket, destination: &mut [u8]) -> Option<()> {
+ source.write_to(destination).ok()
+}
diff --git a/rust/zerocopy/benches/write_to_dynamic_size.x86-64 b/rust/zerocopy/benches/write_to_dynamic_size.x86-64
new file mode 100644
index 000000000..c5abb17f7
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_dynamic_size.x86-64
@@ -0,0 +1,21 @@
+bench_write_to_dynamic_size:
+ push r14
+ push rbx
+ push rax
+ mov rbx, rcx
+ lea r14, [2*rsi + 5]
+ and r14, -2
+ cmp rcx, r14
+ jne .LBB5_2
+ mov rax, rdi
+ mov rdi, rdx
+ mov rsi, rax
+ mov rdx, rbx
+ call qword ptr [rip + memcpy@GOTPCREL]
+.LBB5_2:
+ cmp rbx, r14
+ sete al
+ add rsp, 8
+ pop rbx
+ pop r14
+ ret
diff --git a/rust/zerocopy/benches/write_to_dynamic_size.x86-64.mca b/rust/zerocopy/benches/write_to_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..5b2c08a31
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_dynamic_size.x86-64.mca
@@ -0,0 +1,77 @@
+Iterations: 100
+Instructions: 1900
+Total Cycles: 2890
+Total uOps: 2500
+
+Dispatch Width: 4
+uOps Per Cycle: 0.87
+IPC: 0.66
+Block RThroughput: 6.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 2 5 1.00 * push r14
+ 2 5 1.00 * push rbx
+ 2 5 1.00 * push rax
+ 1 1 0.33 mov rbx, rcx
+ 1 1 0.50 lea r14, [2*rsi + 5]
+ 1 1 0.33 and r14, -2
+ 1 1 0.33 cmp rcx, r14
+ 1 1 1.00 jne .LBB5_2
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 mov rdi, rdx
+ 1 1 0.33 mov rsi, rax
+ 1 1 0.33 mov rdx, rbx
+ 4 7 1.00 * call qword ptr [rip + memcpy@GOTPCREL]
+ 1 1 0.33 cmp rbx, r14
+ 1 1 0.50 sete al
+ 1 1 0.33 add rsp, 8
+ 1 6 0.50 * pop rbx
+ 1 6 0.50 * pop r14
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 4.66 4.64 4.00 4.70 4.00 3.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - 1.00 - - 1.00 push r14
+ - - - - 1.00 - 1.00 - push rbx
+ - - - - 1.00 - - 1.00 push rax
+ - - 0.02 0.97 - 0.01 - - mov rbx, rcx
+ - - 0.97 0.03 - - - - lea r14, [2*rsi + 5]
+ - - 0.63 0.35 - 0.02 - - and r14, -2
+ - - 0.31 0.34 - 0.35 - - cmp rcx, r14
+ - - - - - 1.00 - - jne .LBB5_2
+ - - 0.33 0.33 - 0.34 - - mov rax, rdi
+ - - 0.36 0.31 - 0.33 - - mov rdi, rdx
+ - - 0.33 0.35 - 0.32 - - mov rsi, rax
+ - - 0.35 0.63 - 0.02 - - mov rdx, rbx
+ - - - - 1.00 1.00 2.00 - call qword ptr [rip + memcpy@GOTPCREL]
+ - - 0.65 0.35 - - - - cmp rbx, r14
+ - - 0.69 - - 0.31 - - sete al
+ - - 0.02 0.98 - - - - add rsp, 8
+ - - - - - - - 1.00 pop rbx
+ - - - - - - 1.00 - pop r14
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/write_to_prefix_dynamic_size.rs b/rust/zerocopy/benches/write_to_prefix_dynamic_size.rs
new file mode 100644
index 000000000..a54d32773
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_prefix_dynamic_size.rs
@@ -0,0 +1,12 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_write_to_prefix_dynamic_size(
+ source: &format::CocoPacket,
+ destination: &mut [u8],
+) -> Option<()> {
+ source.write_to_prefix(destination).ok()
+}
diff --git a/rust/zerocopy/benches/write_to_prefix_dynamic_size.x86-64 b/rust/zerocopy/benches/write_to_prefix_dynamic_size.x86-64
new file mode 100644
index 000000000..d7779c6c9
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_prefix_dynamic_size.x86-64
@@ -0,0 +1,21 @@
+bench_write_to_prefix_dynamic_size:
+ push r14
+ push rbx
+ push rax
+ mov rbx, rcx
+ lea r14, [2*rsi + 5]
+ and r14, -2
+ cmp r14, rcx
+ ja .LBB5_2
+ mov rax, rdi
+ mov rdi, rdx
+ mov rsi, rax
+ mov rdx, r14
+ call qword ptr [rip + memcpy@GOTPCREL]
+.LBB5_2:
+ cmp r14, rbx
+ setbe al
+ add rsp, 8
+ pop rbx
+ pop r14
+ ret
diff --git a/rust/zerocopy/benches/write_to_prefix_dynamic_size.x86-64.mca b/rust/zerocopy/benches/write_to_prefix_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..4cebe24d4
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_prefix_dynamic_size.x86-64.mca
@@ -0,0 +1,77 @@
+Iterations: 100
+Instructions: 1900
+Total Cycles: 2890
+Total uOps: 2600
+
+Dispatch Width: 4
+uOps Per Cycle: 0.90
+IPC: 0.66
+Block RThroughput: 6.5
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 2 5 1.00 * push r14
+ 2 5 1.00 * push rbx
+ 2 5 1.00 * push rax
+ 1 1 0.33 mov rbx, rcx
+ 1 1 0.50 lea r14, [2*rsi + 5]
+ 1 1 0.33 and r14, -2
+ 1 1 0.33 cmp r14, rcx
+ 1 1 1.00 ja .LBB5_2
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 mov rdi, rdx
+ 1 1 0.33 mov rsi, rax
+ 1 1 0.33 mov rdx, r14
+ 4 7 1.00 * call qword ptr [rip + memcpy@GOTPCREL]
+ 1 1 0.33 cmp r14, rbx
+ 2 2 1.00 setbe al
+ 1 1 0.33 add rsp, 8
+ 1 6 0.50 * pop rbx
+ 1 6 0.50 * pop r14
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 5.47 4.49 4.00 5.04 4.00 3.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - 1.00 - - 1.00 push r14
+ - - - - 1.00 - 1.00 - push rbx
+ - - - - 1.00 - - 1.00 push rax
+ - - 0.48 0.51 - 0.01 - - mov rbx, rcx
+ - - 0.51 0.49 - - - - lea r14, [2*rsi + 5]
+ - - 0.48 0.05 - 0.47 - - and r14, -2
+ - - 0.48 0.49 - 0.03 - - cmp r14, rcx
+ - - - - - 1.00 - - ja .LBB5_2
+ - - 0.04 0.47 - 0.49 - - mov rax, rdi
+ - - 0.49 0.03 - 0.48 - - mov rdi, rdx
+ - - 0.03 0.48 - 0.49 - - mov rsi, rax
+ - - 0.48 0.51 - 0.01 - - mov rdx, r14
+ - - - - 1.00 1.00 2.00 - call qword ptr [rip + memcpy@GOTPCREL]
+ - - 0.51 0.49 - - - - cmp r14, rbx
+ - - 1.94 - - 0.06 - - setbe al
+ - - 0.03 0.97 - - - - add rsp, 8
+ - - - - - - - 1.00 pop rbx
+ - - - - - - 1.00 - pop r14
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/write_to_prefix_static_size.rs b/rust/zerocopy/benches/write_to_prefix_static_size.rs
new file mode 100644
index 000000000..826222c12
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_prefix_static_size.rs
@@ -0,0 +1,12 @@
+use zerocopy::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_write_to_prefix_static_size(
+ source: &format::CocoPacket,
+ destination: &mut [u8],
+) -> Option<()> {
+ source.write_to_prefix(destination).ok()
+}
diff --git a/rust/zerocopy/benches/write_to_prefix_static_size.x86-64 b/rust/zerocopy/benches/write_to_prefix_static_size.x86-64
new file mode 100644
index 000000000..9cf066295
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_prefix_static_size.x86-64
@@ -0,0 +1,11 @@
+bench_write_to_prefix_static_size:
+ cmp rdx, 6
+ jb .LBB5_2
+ movzx eax, word ptr [rdi + 4]
+ mov word ptr [rsi + 4], ax
+ mov eax, dword ptr [rdi]
+ mov dword ptr [rsi], eax
+.LBB5_2:
+ cmp rdx, 6
+ setae al
+ ret
diff --git a/rust/zerocopy/benches/write_to_prefix_static_size.x86-64.mca b/rust/zerocopy/benches/write_to_prefix_static_size.x86-64.mca
new file mode 100644
index 000000000..5d17200ab
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_prefix_static_size.x86-64.mca
@@ -0,0 +1,57 @@
+Iterations: 100
+Instructions: 900
+Total Cycles: 233
+Total uOps: 900
+
+Dispatch Width: 4
+uOps Per Cycle: 3.86
+IPC: 3.86
+Block RThroughput: 2.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 cmp rdx, 6
+ 1 1 1.00 jb .LBB5_2
+ 1 5 0.50 * movzx eax, word ptr [rdi + 4]
+ 1 1 1.00 * mov word ptr [rsi + 4], ax
+ 1 5 0.50 * mov eax, dword ptr [rdi]
+ 1 1 1.00 * mov dword ptr [rsi], eax
+ 1 1 0.33 cmp rdx, 6
+ 1 1 0.50 setae al
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 1.50 1.49 2.00 2.01 2.00 2.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.25 0.74 - 0.01 - - cmp rdx, 6
+ - - - - - 1.00 - - jb .LBB5_2
+ - - - - - - 0.50 0.50 movzx eax, word ptr [rdi + 4]
+ - - - - 1.00 - 0.48 0.52 mov word ptr [rsi + 4], ax
+ - - - - - - 0.52 0.48 mov eax, dword ptr [rdi]
+ - - - - 1.00 - 0.50 0.50 mov dword ptr [rsi], eax
+ - - 0.25 0.75 - - - - cmp rdx, 6
+ - - 1.00 - - - - - setae al
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/write_to_static_size.rs b/rust/zerocopy/benches/write_to_static_size.rs
new file mode 100644
index 000000000..3bb9435c5
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_static_size.rs
@@ -0,0 +1,9 @@
+use zerocopy::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_write_to_static_size(source: &format::CocoPacket, destination: &mut [u8]) -> Option<()> {
+ source.write_to(destination).ok()
+}
diff --git a/rust/zerocopy/benches/write_to_static_size.x86-64 b/rust/zerocopy/benches/write_to_static_size.x86-64
new file mode 100644
index 000000000..d6413e0fd
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_static_size.x86-64
@@ -0,0 +1,11 @@
+bench_write_to_static_size:
+ cmp rdx, 6
+ jne .LBB5_2
+ movzx eax, word ptr [rdi + 4]
+ mov word ptr [rsi + 4], ax
+ mov eax, dword ptr [rdi]
+ mov dword ptr [rsi], eax
+.LBB5_2:
+ cmp rdx, 6
+ sete al
+ ret
diff --git a/rust/zerocopy/benches/write_to_static_size.x86-64.mca b/rust/zerocopy/benches/write_to_static_size.x86-64.mca
new file mode 100644
index 000000000..cc5bb1d26
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_static_size.x86-64.mca
@@ -0,0 +1,57 @@
+Iterations: 100
+Instructions: 900
+Total Cycles: 233
+Total uOps: 900
+
+Dispatch Width: 4
+uOps Per Cycle: 3.86
+IPC: 3.86
+Block RThroughput: 2.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 cmp rdx, 6
+ 1 1 1.00 jne .LBB5_2
+ 1 5 0.50 * movzx eax, word ptr [rdi + 4]
+ 1 1 1.00 * mov word ptr [rsi + 4], ax
+ 1 5 0.50 * mov eax, dword ptr [rdi]
+ 1 1 1.00 * mov dword ptr [rsi], eax
+ 1 1 0.33 cmp rdx, 6
+ 1 1 0.50 sete al
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 1.50 1.49 2.00 2.01 2.00 2.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.25 0.74 - 0.01 - - cmp rdx, 6
+ - - - - - 1.00 - - jne .LBB5_2
+ - - - - - - 0.50 0.50 movzx eax, word ptr [rdi + 4]
+ - - - - 1.00 - 0.48 0.52 mov word ptr [rsi + 4], ax
+ - - - - - - 0.52 0.48 mov eax, dword ptr [rdi]
+ - - - - 1.00 - 0.50 0.50 mov dword ptr [rsi], eax
+ - - 0.25 0.75 - - - - cmp rdx, 6
+ - - 1.00 - - - - - sete al
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/write_to_suffix_dynamic_size.rs b/rust/zerocopy/benches/write_to_suffix_dynamic_size.rs
new file mode 100644
index 000000000..9fa6b91cd
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_suffix_dynamic_size.rs
@@ -0,0 +1,12 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_write_to_suffix_dynamic_size(
+ source: &format::CocoPacket,
+ destination: &mut [u8],
+) -> Option<()> {
+ source.write_to_suffix(destination).ok()
+}
diff --git a/rust/zerocopy/benches/write_to_suffix_dynamic_size.x86-64 b/rust/zerocopy/benches/write_to_suffix_dynamic_size.x86-64
new file mode 100644
index 000000000..75f349562
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_suffix_dynamic_size.x86-64
@@ -0,0 +1,22 @@
+bench_write_to_suffix_dynamic_size:
+ push r14
+ push rbx
+ push rax
+ mov rbx, rcx
+ lea r14, [2*rsi + 5]
+ and r14, -2
+ sub rcx, r14
+ jb .LBB5_2
+ mov rax, rdi
+ add rdx, rcx
+ mov rdi, rdx
+ mov rsi, rax
+ mov rdx, r14
+ call qword ptr [rip + memcpy@GOTPCREL]
+.LBB5_2:
+ cmp rbx, r14
+ setae al
+ add rsp, 8
+ pop rbx
+ pop r14
+ ret
diff --git a/rust/zerocopy/benches/write_to_suffix_dynamic_size.x86-64.mca b/rust/zerocopy/benches/write_to_suffix_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..95cb9dfe2
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_suffix_dynamic_size.x86-64.mca
@@ -0,0 +1,79 @@
+Iterations: 100
+Instructions: 2000
+Total Cycles: 2890
+Total uOps: 2600
+
+Dispatch Width: 4
+uOps Per Cycle: 0.90
+IPC: 0.69
+Block RThroughput: 6.5
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 2 5 1.00 * push r14
+ 2 5 1.00 * push rbx
+ 2 5 1.00 * push rax
+ 1 1 0.33 mov rbx, rcx
+ 1 1 0.50 lea r14, [2*rsi + 5]
+ 1 1 0.33 and r14, -2
+ 1 1 0.33 sub rcx, r14
+ 1 1 1.00 jb .LBB5_2
+ 1 1 0.33 mov rax, rdi
+ 1 1 0.33 add rdx, rcx
+ 1 1 0.33 mov rdi, rdx
+ 1 1 0.33 mov rsi, rax
+ 1 1 0.33 mov rdx, r14
+ 4 7 1.00 * call qword ptr [rip + memcpy@GOTPCREL]
+ 1 1 0.33 cmp rbx, r14
+ 1 1 0.50 setae al
+ 1 1 0.33 add rsp, 8
+ 1 6 0.50 * pop rbx
+ 1 6 0.50 * pop r14
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 4.98 4.98 4.00 5.04 4.00 3.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - 1.00 - - 1.00 push r14
+ - - - - 1.00 - 1.00 - push rbx
+ - - - - 1.00 - - 1.00 push rax
+ - - 0.94 0.05 - 0.01 - - mov rbx, rcx
+ - - 0.06 0.94 - - - - lea r14, [2*rsi + 5]
+ - - 0.93 0.02 - 0.05 - - and r14, -2
+ - - 0.05 0.94 - 0.01 - - sub rcx, r14
+ - - - - - 1.00 - - jb .LBB5_2
+ - - 0.02 0.04 - 0.94 - - mov rax, rdi
+ - - 0.03 0.97 - - - - add rdx, rcx
+ - - 0.95 0.05 - - - - mov rdi, rdx
+ - - 0.94 0.03 - 0.03 - - mov rsi, rax
+ - - 0.01 0.03 - 0.96 - - mov rdx, r14
+ - - - - 1.00 1.00 2.00 - call qword ptr [rip + memcpy@GOTPCREL]
+ - - 0.05 0.94 - 0.01 - - cmp rbx, r14
+ - - 0.97 - - 0.03 - - setae al
+ - - 0.03 0.97 - - - - add rsp, 8
+ - - - - - - - 1.00 pop rbx
+ - - - - - - 1.00 - pop r14
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/write_to_suffix_static_size.rs b/rust/zerocopy/benches/write_to_suffix_static_size.rs
new file mode 100644
index 000000000..1c95aba4b
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_suffix_static_size.rs
@@ -0,0 +1,12 @@
+use zerocopy::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_write_to_suffix_static_size(
+ source: &format::CocoPacket,
+ destination: &mut [u8],
+) -> Option<()> {
+ source.write_to_suffix(destination).ok()
+}
diff --git a/rust/zerocopy/benches/write_to_suffix_static_size.x86-64 b/rust/zerocopy/benches/write_to_suffix_static_size.x86-64
new file mode 100644
index 000000000..934aa370d
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_suffix_static_size.x86-64
@@ -0,0 +1,11 @@
+bench_write_to_suffix_static_size:
+ cmp rdx, 6
+ jb .LBB5_2
+ movzx eax, word ptr [rdi + 4]
+ mov word ptr [rsi + rdx - 2], ax
+ mov eax, dword ptr [rdi]
+ mov dword ptr [rsi + rdx - 6], eax
+.LBB5_2:
+ cmp rdx, 6
+ setae al
+ ret
diff --git a/rust/zerocopy/benches/write_to_suffix_static_size.x86-64.mca b/rust/zerocopy/benches/write_to_suffix_static_size.x86-64.mca
new file mode 100644
index 000000000..6b18e4a44
--- /dev/null
+++ b/rust/zerocopy/benches/write_to_suffix_static_size.x86-64.mca
@@ -0,0 +1,57 @@
+Iterations: 100
+Instructions: 900
+Total Cycles: 233
+Total uOps: 900
+
+Dispatch Width: 4
+uOps Per Cycle: 3.86
+IPC: 3.86
+Block RThroughput: 2.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.33 cmp rdx, 6
+ 1 1 1.00 jb .LBB5_2
+ 1 5 0.50 * movzx eax, word ptr [rdi + 4]
+ 1 1 1.00 * mov word ptr [rsi + rdx - 2], ax
+ 1 5 0.50 * mov eax, dword ptr [rdi]
+ 1 1 1.00 * mov dword ptr [rsi + rdx - 6], eax
+ 1 1 0.33 cmp rdx, 6
+ 1 1 0.50 setae al
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 1.50 1.49 2.00 2.01 2.00 2.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.25 0.74 - 0.01 - - cmp rdx, 6
+ - - - - - 1.00 - - jb .LBB5_2
+ - - - - - - 0.50 0.50 movzx eax, word ptr [rdi + 4]
+ - - - - 1.00 - 0.48 0.52 mov word ptr [rsi + rdx - 2], ax
+ - - - - - - 0.52 0.48 mov eax, dword ptr [rdi]
+ - - - - 1.00 - 0.50 0.50 mov dword ptr [rsi + rdx - 6], eax
+ - - 0.25 0.75 - - - - cmp rdx, 6
+ - - 1.00 - - - - - setae al
+ - - - - - 1.00 - - ret
diff --git a/rust/zerocopy/benches/zero_dynamic_padding.rs b/rust/zerocopy/benches/zero_dynamic_padding.rs
new file mode 100644
index 000000000..8eda0953d
--- /dev/null
+++ b/rust/zerocopy/benches/zero_dynamic_padding.rs
@@ -0,0 +1,9 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_padding.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_zero_dynamic_padding(source: &mut format::LocoPacket) {
+ source.zero()
+}
diff --git a/rust/zerocopy/benches/zero_dynamic_padding.x86-64 b/rust/zerocopy/benches/zero_dynamic_padding.x86-64
new file mode 100644
index 000000000..7dccf1745
--- /dev/null
+++ b/rust/zerocopy/benches/zero_dynamic_padding.x86-64
@@ -0,0 +1,7 @@
+bench_zero_dynamic_padding:
+ lea rax, [rsi + 2*rsi]
+ movabs rdx, 9223372036854775804
+ and rdx, rax
+ add rdx, 12
+ xor esi, esi
+ jmp qword ptr [rip + memset@GOTPCREL]
diff --git a/rust/zerocopy/benches/zero_dynamic_padding.x86-64.mca b/rust/zerocopy/benches/zero_dynamic_padding.x86-64.mca
new file mode 100644
index 000000000..098fc1078
--- /dev/null
+++ b/rust/zerocopy/benches/zero_dynamic_padding.x86-64.mca
@@ -0,0 +1,51 @@
+Iterations: 100
+Instructions: 600
+Total Cycles: 209
+Total uOps: 700
+
+Dispatch Width: 4
+uOps Per Cycle: 3.35
+IPC: 2.87
+Block RThroughput: 1.8
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.50 lea rax, [rsi + 2*rsi]
+ 1 1 0.33 movabs rdx, 9223372036854775804
+ 1 1 0.33 and rdx, rax
+ 1 1 0.33 add rdx, 12
+ 1 0 0.25 xor esi, esi
+ 2 6 1.00 * jmp qword ptr [rip + memset@GOTPCREL]
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 1.66 1.66 - 1.68 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.33 0.67 - - - - lea rax, [rsi + 2*rsi]
+ - - 0.98 - - 0.02 - - movabs rdx, 9223372036854775804
+ - - 0.01 0.66 - 0.33 - - and rdx, rax
+ - - 0.34 0.33 - 0.33 - - add rdx, 12
+ - - - - - - - - xor esi, esi
+ - - - - - 1.00 0.50 0.50 jmp qword ptr [rip + memset@GOTPCREL]
diff --git a/rust/zerocopy/benches/zero_dynamic_size.rs b/rust/zerocopy/benches/zero_dynamic_size.rs
new file mode 100644
index 000000000..536d800eb
--- /dev/null
+++ b/rust/zerocopy/benches/zero_dynamic_size.rs
@@ -0,0 +1,9 @@
+use zerocopy::*;
+
+#[path = "formats/coco_dynamic_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_zero_dynamic_size(source: &mut format::LocoPacket) {
+ source.zero()
+}
diff --git a/rust/zerocopy/benches/zero_dynamic_size.x86-64 b/rust/zerocopy/benches/zero_dynamic_size.x86-64
new file mode 100644
index 000000000..2b31ed644
--- /dev/null
+++ b/rust/zerocopy/benches/zero_dynamic_size.x86-64
@@ -0,0 +1,5 @@
+bench_zero_dynamic_size:
+ lea rdx, [2*rsi + 5]
+ and rdx, -2
+ xor esi, esi
+ jmp qword ptr [rip + memset@GOTPCREL]
diff --git a/rust/zerocopy/benches/zero_dynamic_size.x86-64.mca b/rust/zerocopy/benches/zero_dynamic_size.x86-64.mca
new file mode 100644
index 000000000..0b086a29b
--- /dev/null
+++ b/rust/zerocopy/benches/zero_dynamic_size.x86-64.mca
@@ -0,0 +1,47 @@
+Iterations: 100
+Instructions: 400
+Total Cycles: 142
+Total uOps: 500
+
+Dispatch Width: 4
+uOps Per Cycle: 3.52
+IPC: 2.82
+Block RThroughput: 1.3
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 0.50 lea rdx, [2*rsi + 5]
+ 1 1 0.33 and rdx, -2
+ 1 0 0.25 xor esi, esi
+ 2 6 1.00 * jmp qword ptr [rip + memset@GOTPCREL]
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - 0.99 1.00 - 1.01 0.50 0.50
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - 0.99 0.01 - - - - lea rdx, [2*rsi + 5]
+ - - - 0.99 - 0.01 - - and rdx, -2
+ - - - - - - - - xor esi, esi
+ - - - - - 1.00 0.50 0.50 jmp qword ptr [rip + memset@GOTPCREL]
diff --git a/rust/zerocopy/benches/zero_static_size.rs b/rust/zerocopy/benches/zero_static_size.rs
new file mode 100644
index 000000000..fa7fa0839
--- /dev/null
+++ b/rust/zerocopy/benches/zero_static_size.rs
@@ -0,0 +1,9 @@
+use zerocopy::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_zero_static_size(source: &mut format::LocoPacket) {
+ source.zero()
+}
diff --git a/rust/zerocopy/benches/zero_static_size.x86-64 b/rust/zerocopy/benches/zero_static_size.x86-64
new file mode 100644
index 000000000..ced8e1894
--- /dev/null
+++ b/rust/zerocopy/benches/zero_static_size.x86-64
@@ -0,0 +1,4 @@
+bench_zero_static_size:
+ mov word ptr [rdi + 4], 0
+ mov dword ptr [rdi], 0
+ ret
diff --git a/rust/zerocopy/benches/zero_static_size.x86-64.mca b/rust/zerocopy/benches/zero_static_size.x86-64.mca
new file mode 100644
index 000000000..042897ef2
--- /dev/null
+++ b/rust/zerocopy/benches/zero_static_size.x86-64.mca
@@ -0,0 +1,45 @@
+Iterations: 100
+Instructions: 300
+Total Cycles: 203
+Total uOps: 300
+
+Dispatch Width: 4
+uOps Per Cycle: 1.48
+IPC: 1.48
+Block RThroughput: 2.0
+
+
+Instruction Info:
+[1]: #uOps
+[2]: Latency
+[3]: RThroughput
+[4]: MayLoad
+[5]: MayStore
+[6]: HasSideEffects (U)
+
+[1] [2] [3] [4] [5] [6] Instructions:
+ 1 1 1.00 * mov word ptr [rdi + 4], 0
+ 1 1 1.00 * mov dword ptr [rdi], 0
+ 1 1 1.00 U ret
+
+
+Resources:
+[0] - SBDivider
+[1] - SBFPDivider
+[2] - SBPort0
+[3] - SBPort1
+[4] - SBPort4
+[5] - SBPort5
+[6.0] - SBPort23
+[6.1] - SBPort23
+
+
+Resource pressure per iteration:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1]
+ - - - - 2.00 1.00 1.00 1.00
+
+Resource pressure by instruction:
+[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
+ - - - - 1.00 - - 1.00 mov word ptr [rdi + 4], 0
+ - - - - 1.00 - 1.00 - mov dword ptr [rdi], 0
+ - - - - - 1.00 - - ret