element-hq / element-ios

A glossy Matrix collaboration client for iOS
https://element.io
Apache License 2.0
1.72k stars 480 forks source link

Improve main target build time #5384

Open stefanceriu opened 2 years ago

stefanceriu commented 2 years ago

Currently building the Riot target is quite slow, especially on incremental builds. This makes using it for development purposes and SwiftUI previews quite cumbersome. We should investigate ways of speeding it up.

Current build times:

wtimme commented 2 years ago

You are correct with your observation. On my machine (MacBook Pro (13-inch, 2020)), a clean build takes around 440 seconds - that's more than 7 minutes.

From the XcodeGen target definitions, it looks that a lot of code (especially the one in Riot/Modules/MatrixKit) is included by and therefore compiled for multiple targets. Take a look at my build log (for the scheme "Riot"):

Screenshot 2022-05-31 at 13 28 44

MXKCallViewController.m is being compiled four times!

I suggest we take a step back and re-think the files that the project contains, and derive dedicated framework targets from that. Then, the app/intents/extension targets could depend on shared frameworks, and that code would only be compiled once.