Reputation: 82
I was working on a iOS Framework and I had some query regarding the size of the library. I wanted to ask if the size of the SDK will more if I have more number of files and classes OR the size will be greater if I have less files with same functionality increasing the lines of code in each file.
Upvotes: 0
Views: 156
Reputation: 100543
Short: it doesn't really matter.
Long: Difference is maybe a few hundred bytes. It is mostly influenced by the compiler's optimization settings (-Os flag vs -O1..-O3 etc). I would worry more about code maintainability than about output size (> separation of concerns, designing components with emergent behavior, testability / isolation of classes etc).
However, if you are using swift, the binary size will increase substantially if you make heavy use of generics as the code for each generic type is duplicated at compile time for each use. (seen this while making heavy use of RxSwift).
Also note that resources like images, audio files and video content usually make up most of the size of typical apps.
Upvotes: 2
Reputation: 104065
It does not matter. Split the code into files in a way that’s most readable and maintainable.
Upvotes: 1