How do structs increase binary size?

In this talk (https://www.skilled.io/u/swiftsummit/swift-with-a-hundred-engineers) the speaker says, " First, you have to be aware that structs can increase your binary size." Why and when would this be the case?

Thanks!

One case historically was that the code to copy each member of a struct was generated inline, so if you assigned a struct with 100 object members and the optimizer was unable to eliminate the copy, it would splat out 100 calls to retain. My recollection is that that has since been corrected and a call to an out of line synthesized copy function is inserted instead.

1 Like
Terms of Service

Privacy Policy

Cookie Policy