Hmm, I noticed that my types are of the same size so there is a concern of some optimization there. I changed B to also contain a Float64/f64.
Now we have Julia:
Dynamic Dispatch:
4.673 ms (0 allocations: 0 bytes)
Static Dispatch
256.708 μs (0 allocations: 0 bytes)
and Rust:
dynamic dispatch time: [4.4012 ms 4.4029 ms 4.4048 ms]
change: [+361.64% +362.24% +362.81%] (p = 0.00 < 0.05)
Performance has regressed.
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) high severe
static dispatch time: [260.19 µs 260.35 µs 260.53 µs]
change: [+172.74% +173.19% +173.81%] (p = 0.00 < 0.05)
Performance has regressed.
Found 7 outliers among 100 measurements (7.00%)
1 (1.00%) high mild
6 (6.00%) high severe
Looks like they match up pretty closely now. The point of dictionary lookup vs array lookup is a good one. I suppose Julia is forced to be a little slower on that front to allow for extra flexibility