Any use of concrete fields should be fully optimizable no matter what is in the other fields.
julia> struct F
a::Int
b
c
d
e
end
julia> b = F(1,2,3,4,5)
F(1, 2, 3, 4, 5)
julia> f(A::F, B::F) = A.a + B.a
f (generic function with 1 method)
julia> @code_native f(b,b)
.section __TEXT,__text,regular,pure_instructions
; Function f {
; Location: REPL[33]:1
; Function +; {
; Location: REPL[33]:1
movq (%rsi), %rax
addq (%rdi), %rax
;}
retq
nopw (%rax,%rax)
;}