I’ve got a a more detailed writeup and benchmark code but here’s a summary of the issue I’m having.
The workload in question (a simplified version of real code) is quite small: read a few bytes from a
Read, then return a struct. See the link for source; there are various flavors of this workload but they’re all the same idea.
I’m getting counterintuitive relative performance with various sizes of structs. A struct with three
Option<u8> and another with one
Option<u16> and five
Option<u8> both give me fast performance, but a struct with one
Option<u16> and two
Option<u8> is half as fast. In other words, both smaller and larger structs are 2x as fast. However, this performance gap only happens when mapping
Err values (from the i/o) a particular way, and only for that struct size.
What could be causing this?