The accessors benchmark suggests that ARec field access should be only slightly worse than Rec field access for fields in the front and stay constant for fields with higher indices while Rec fields become increasingly more expensive to access. For example, on my machine, access to Rec takes 6.1ns for index 0 up to 12.4ns for index 15, for an average of ~9.2ns. On the other hand, access time ARec fields is constant with ~7.5 ns. (See included figure)
This would suggest that for access patterns that exercise all fields equally, ARec should outperform Rec. However, I added a new benchmark simulating random read access where I retrieve all elements once and calculate their sum: Link to gist
Here, ARec fares significantly worse than Rec with 68 vs 55 ns!

I find this discrepancy surprising. Is there perhaps a problem in the way the benchmark is written?
The
accessorsbenchmark suggests that ARec field access should be only slightly worse than Rec field access for fields in the front and stay constant for fields with higher indices while Rec fields become increasingly more expensive to access. For example, on my machine, access to Rec takes 6.1ns for index 0 up to 12.4ns for index 15, for an average of ~9.2ns. On the other hand, access time ARec fields is constant with ~7.5 ns. (See included figure)This would suggest that for access patterns that exercise all fields equally, ARec should outperform Rec. However, I added a new benchmark simulating random read access where I retrieve all elements once and calculate their sum: Link to gist
Here, ARec fares significantly worse than Rec with 68 vs 55 ns!
I find this discrepancy surprising. Is there perhaps a problem in the way the benchmark is written?