Handmade Hero»Forums»Code
David Roguin
15 posts
Unity Build vs Autotools from a time perspective
I've always used Autotools for my personal C++ projects, but after hearing Casey talk about this Unity Build thing, I had to try it out for myself.

So, right now I have a small project, that is 1100 lines of code scattered into 10 files; a complete rebuild takes like 8 seconds, a very simple change, like modifying a stupid thing in only one cpp file only took half a second to complete, that was the best case but the most unreal scenario, with more real changes the build time took between 2 and 4 seconds.

Unity build, always, always took 2 seconds, which I thing is really great, and I even didn't have to change that much from my codebase to make it work.

I will post again in a few weeks when the project is getting bigger to see how the this evolves.
Allen Webster
473 posts / 2 projects
Heyo
Unity Build vs Autotools from a time perspective
Thanks for working on this! It will be nice to have concrete evidence that it works. I trust Casey implicitly because he has five years of experience for every one year I have. Still the more tests in support of the Unity Build, the less I have to wonder about it.
Johan Öfverstedt
45 posts
Unity Build vs Autotools from a time perspective
Mr4thDimention
Thanks for working on this! It will be nice to have concrete evidence that it works. I trust Casey implicitly because he has five years of experience for every one year I have. Still the more tests in support of the Unity Build, the less I have to wonder about it.


I have also tested it on a project with 15000 lines of code and, sure sometimes it might take slightly longer, but it compiles in like 1 minute on my crappy laptop with full optimizations on and much faster with -O1. It's also cleaner to maintain across platforms since I always only have one file to compile on each platform, I don't have to muck around with XCode and add every new file I create to the project to recompile. Btw, I use XCode because that's the simplest way to generate a bundle with resources included on the MAC. Generally I would prefer command line compilation.
Kasper Sauramo
19 posts
Unity Build vs Autotools from a time perspective
One downside is the erronous errors on syntax checking and lack of code completion. If some IDE's/editor plugins are smart enough to handle the fact that no file leads you to the used variables I'd be happy to hear about them!
Christopher
17 posts
Unity Build vs Autotools from a time perspective
So is it the linker that is so slow?

I can say for sure I'm switching to unity build (and avoiding templates) at least for personal projects. compile times have been driving me nuts
Allen Webster
473 posts / 2 projects
Heyo
Unity Build vs Autotools from a time perspective
The linker probably contributes a lot. I wouldn't be surprised if the entire process of starting up and finishing a single translation unit had a good deal of overhead too. Not that it makes sense for it to work that way, but I wouldn't be surprised if it did.
Johan Öfverstedt
45 posts
Unity Build vs Autotools from a time perspective
The linker probably is one of the culprits. Furthermore, think about what happens when you include large webs of headers, for example when using boost. They are brought in and parsed in every translation unit separately instead of only once for the whole project (if include guards are used) which I would think is very expensive.
Kasper Sauramo
19 posts
Unity Build vs Autotools from a time perspective
As far as I've read the main culprit is usually said to be file IO. In Unity you load each file once.