Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benches/formats/coco_dynamic_padding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub enum C0C0 {
_XC0C0 = 0xC0C0,
}

#[derive(FromBytes, KnownLayout, Immutable)]
#[derive(FromBytes, KnownLayout, Immutable, SplitAt)]
#[repr(C, align(4))]
pub struct Packet<Magic> {
magic_number: Magic,
Expand Down
2 changes: 1 addition & 1 deletion benches/formats/coco_dynamic_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub enum C0C0 {

macro_rules! define_packet {
($name: ident, $trait: ident, $leading_field: ty) => {
#[derive($trait, KnownLayout, Immutable, IntoBytes)]
#[derive($trait, KnownLayout, Immutable, IntoBytes, SplitAt)]
#[repr(C, align(2))]
pub struct $name {
magic_number: $leading_field,
Expand Down
12 changes: 12 additions & 0 deletions benches/split_at_dynamic_padding.rs
Original file line number Diff line number Diff line change
@@ -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)
}
12 changes: 12 additions & 0 deletions benches/split_at_dynamic_padding.x86-64
Original file line number Diff line number Diff line change
@@ -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
59 changes: 59 additions & 0 deletions benches/split_at_dynamic_padding.x86-64.mca
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions benches/split_at_dynamic_size.rs
Original file line number Diff line number Diff line change
@@ -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)
}
12 changes: 12 additions & 0 deletions benches/split_at_dynamic_size.x86-64
Original file line number Diff line number Diff line change
@@ -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
59 changes: 59 additions & 0 deletions benches/split_at_dynamic_size.x86-64.mca
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions benches/split_at_unchecked_dynamic_padding.rs
Original file line number Diff line number Diff line change
@@ -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) }
}
6 changes: 6 additions & 0 deletions benches/split_at_unchecked_dynamic_padding.x86-64
Original file line number Diff line number Diff line change
@@ -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
49 changes: 49 additions & 0 deletions benches/split_at_unchecked_dynamic_padding.x86-64.mca
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions benches/split_at_unchecked_dynamic_size.rs
Original file line number Diff line number Diff line change
@@ -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) }
}
6 changes: 6 additions & 0 deletions benches/split_at_unchecked_dynamic_size.x86-64
Original file line number Diff line number Diff line change
@@ -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
49 changes: 49 additions & 0 deletions benches/split_at_unchecked_dynamic_size.x86-64.mca
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions benches/split_via_immutable_dynamic_padding.rs
Original file line number Diff line number Diff line change
@@ -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()
}
14 changes: 14 additions & 0 deletions benches/split_via_immutable_dynamic_padding.x86-64
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading