Jump to content
  • Advertisement
Sign in to follow this  
Alundra

Unity Something better than Unity Build in the future ?

This topic is 676 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

Actually we use Unity Build to improve the compile speed and reduce the lib size.

Something better is planned in the future for C++ ?

Thanks

Share this post


Link to post
Share on other sites
Advertisement

C++ build speeds are pretty good if your project is structured well. Sometimes that isn't always practical. But I am not aware of there being any changes to C++'s compilation and link model any time soon.

Share this post


Link to post
Share on other sites

I stand corrected - or at least, reminded. Still, modules won't be C++17, certainly not as a full feature. Maybe as an experimental one. It's probably not worth expecting it to slash build times either, though there will be improvement. A well-structured C++ program today much resembles one built with the new module system anyway, so if your problem is that you change interfaces a lot, you're still going to be doing a lot of rebuilds. The main benefit of a unity build is to reduce on file I/O time and that is arguably best addressed these days by throwing an SSD at the problem rather than trying to subvert the system.

Share this post


Link to post
Share on other sites

The main benefit of a unity build is to reduce on file I/O time and that is arguably best addressed these days by throwing an SSD at the problem rather than trying to subvert the system.

Not really.

 

When you compile N files that all of them include the same header, this header gets parsed N times, alongside macros and all that. That's where unity builds shine at.

Precompiled headers help with that problem; but like you said if your project isn't well structured then your precompiled headers will contain lot of non-shared stuff; and causes an almost full rebuild when you change a header.

The problem gets aggravated if a set of 7 files include the same headers, and another set of 10 files include a different set of headers. Unity builds can deal with this well, but precompiled requires to include all set of headers shared by all 17 files.

 

Modules would be the ideal solution to have both modularity and data stored precompiled. But it has been years since it was promised that "modules are around the corner" and yet haven't arrived.

Edited by Matias Goldberg

Share this post


Link to post
Share on other sites

this header gets parsed N times, alongside macros and all that

 

My understanding is that modern compilers are generally too sensible to do that unless they truly need to. #pragma once helps.

 

Obviously if you fill your headers with macros that vary from one compilation unit to the next, the compiler has to re-parse it - but no module system is going to save you from interfaces that your project chooses not to keep static.

Share this post


Link to post
Share on other sites

Depends on how it is compiled.

 

If the compiler is called once with all the files it may have that option.  It would be an enormous command line for large projects/

 

For all major projects I've worked with, I remember them all starting a unique instance for each.  

 

For empirical evidence on the project I've got up right now, watching Visual Studio and task manager, I can see that compiling generates one new compiler process per file for each CPU.  Checking their command lines, they were called individually per file. That data can't easily be preserved in separate running instances of the compiler.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!