How to improve build times?

After some investigations, I’ve tracked down the major culprits to be 1) the archive builder and 2) the manifest builder.

The content in general builds fast (no texture compression), but when the final resource builds, it also performs some special tasks.

game.project:

  • GameProjectBuilder.createArchive took 77.316000
  • ManifestBuilder.buildManifestData took 344.338000
  • Task game.project took 427.038000 s

All content tasks took 471.820000 s (including game.project)
Entire build took 511.35s (not including engine build)

I’ve only looked into the manifest builder issue so far (since it takes 67% of the entire contentcompilation!) and it looks like fairly straight forward to fix.
Basically it’s doing a lot of redundant work over and over again (O(N^2) complexity).

Reminds me of of this quote from Bruce Dawson:

O(n^2) is the sweet spot of badly scaling algorithms: fast enough to make it into production, but slow enough to make things fall down once it gets there

I’ve added issue 5800 to track this (it should be fixed for the next release 1.2.183)

13 Likes

Amazing, thanks so much for this detective work and even an inspirational (?) quote. :partying_face:

4 Likes

Thanks to @totebo for sharing a great repro.
We now have a PR for this issue.
The ManifestBuilder.buildManifestData now takes ~0.1 s on my machine which is a good improvement for everyone bundling their projects :slight_smile:

11 Likes

To come back to this, a build for a pretty chunky project with Defold v1.2.183 clocked in at just over 9 minutes using build server https://build-stage.defold.com. :partying_face:

And this was ~20 minutes before?

He mentioned 30 minutes before.
Now, that might include texture compression, and we’ll look into that as well, to see that it’s as fast as it should be (we’re using a new compression library)

Another thing I’d like to do, for the build server, is to cache library artifacts.
And, also see if we can cache smaller files too, in order to save upload size/time

Now, that might include the texture compression

3 Likes

Around that mark, yes, possibly a little less. It’s not the same project as I mentioned above. In any case, the workflow has improved!

Edit: Back on the original project, which built in 21 minutes previously. With Defold v1.2.184 it now took 15 minutes for the first build. The second build clocked in at 6 minutes! Not sure why it’s so much shorter. We’re in business!

4 Likes