-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release builds are much slower than debug builds. #145
Comments
Wow! Thank you for the investigation, @CraigSiemens! 😍 The enhancement I was thinking about, was removing the
With this, the compiler don't have to compile all the |
I could try giving that a shot. It shouldn't be too complicated now that I've got a branch that adds the Codable conformance everywhere. |
Replacing the
|
Closed by #182 |
Bagbutik-Models
takes ~0:24 for a debug build and ~2:10 for a release build. The other targets don't have this same difference in build times.I asked about this a while ago on Mastodon and you mentioned that
Codable
could be a source of the issue.https://mastodon.social/@mortengregersen/110210277236346597
Experiment
I had some free time so I did a bit of an experiment to see what the effect of the generated
Codable
implementation is on the release build time. I also includedCaseIterable
just incase anything generated by the compiler was the cause. I used https://github.com/sharkdp/hyperfine to benchmark the build times one different branches with the following command.Baseline
This was run on
main
(e1bdc2d).Generating
Codable
andCaseIterable
ConformancesThis was run on https://github.com/CraigSiemens/Bagbutik/tree/generate-codable
On this branch I updated the generation to create the conformances for
Codable
(includingCodingKeys
) andCaseIterable
for all types inBagbutik-Models
.That seems to make the build slower still, so it seems the slower builds are not caused by the compiler generating the conformance, unless it's still doing checks for whether it needs to add conformance to all the files. Watching CPU usage, it spends most of the time using a single core before switching to using all available cores.
Removing
Codable
andCaseIterable
This was run on https://github.com/CraigSiemens/Bagbutik/tree/remove-codable
On this branch I modified the generation to remove
Codable
andCaseIterable
from all models to confirm whether it was the source of the slower build times. This was just for experimenting since the change also causes the rest of the project to fail to build/function.The build was much faster confirming that
Codable
adds a lot to the build time.Results
It appears that adding
Codable
, regardless of whether it uses the compiler generated conformance, is the cause of the increase in build time. The next steps feel like they should be:Codable
shouldn't impact build times that much.Debug configuration
Debug builds show a similar relationship between the different branches, though the total time is shorter and relative improvement is less.
The text was updated successfully, but these errors were encountered: