Assembly generated with
cargo-asm
https://github.com/gnzlbg/cargo-asm
Machine code analysis done with
llvm-mca
https://llvm.org/docs/CommandGuide/llvm-mca.html
diffs generated with
delta
https://github.com/dandavison/delta
diff output converted to html with
aha
https://github.com/theZiz/aha
- Generate assembly with
cargo asm <target function A>
- Copy assembly output of target function
- Repeat 1-2 for
<target function B>
- Generate diff with
delta asmA asmB -w <column_width> --side-by-side | aha --black > <my_diff>.html
- Feed the assembly into
llvm-mca
and examine output
Unfortunately it is not feasible to pipe the output of
cargo asm
intodelta
directly as the output includes debug strings and the assembly of any other function in the crate (with mangled names)
Function signature argument types: &Vec<u32>
vs. &[u32]
Branching vs Branchless with data dependency
- for-range vs. iter-loops
- for-range vs. raw-loops
- zero-initialized storage vs. maybe-uninit storage
- Function signature argument types: Box vs. String
- Enum variant layout: Box vs. String / Box<[u8]> vs. Vec