Static computed property vs static let constant?

For a proof that there's no difference in this specific case see Compiler Explorer
Both compile to the same code when optimizations are enabled.


static output.S.c.getter : Swift.Int:
        push    rbp
        mov     rbp, rsp
        mov     eax, 1234
        pop     rbp
        ret

static output.S.d.getter : Swift.Int:
        push    rbp
        mov     rbp, rsp
        mov     eax, 1234
        pop     rbp
        ret
12 Likes