Jump to content
  • Advertisement
Sign in to follow this  
AndrewH

Speeding up XNA compilation time

This topic is 2547 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

We've all heard about the iteration process. Thankfully C# compiles at lightning speeds. Yet it's content manager does not and I even suspect it's broken in some ways.

I am developing a game library alongside my game and I realized something. Whenever I modified code in the game script it compiled really fast. But when I edited my game library it compiled terribly slowly. I had a huge amount of content in the content pipeline and I suspect it was trying to re-evaluate all of the content. Why is this? XNA is supposed to flag compiled content as already compiled and go through stuff that's been newly added... or at least that's what I think it should do. This made the iteration process a waste of time since changing anything in the game library meant sitting and waiting 5 to 10 seconds for compilation, although changing game code took mere milliseconds to compile.

So I did a test and compiled just the library (and not the game code by ticking do not compile in the solution manager on all other projects). What I got was the lightning speeds of compilation time without the drawback of having a large waiting time on the content pipeline. To re-link the dll, I had to change the output directory of the game library to the output directory of the game's current build profile's directory.

So if you're like me and noticing long compilation times try to do the following:
1. Toggle all projects as "do not build".
2. Toggle "build" on your game library projects ONLY!
3. Set their output paths to the corresponding game output path whether debug or release.
4. If you do add content to the pipeline manually rebuild the game. MANUALLY!

By doing this I can make hundreds of code changes very quickly and when it comes time to add new content, add it in the pipeline and then manually rebuild the solution. That or something went wrong, because to me this sounds more like a workaround. My gut tells me I could just compile and let the content manager take care of the rest, but in this case that was simply not working for me.

Share this post


Link to post
Share on other sites
Advertisement
Might want to give this article a look at:

http://blogs.msdn.com/b/shawnhar/archive/2009/08/14/why-does-my-content-rebuild-every-time.aspx

Share this post


Link to post
Share on other sites

Might want to give this article a look at:

http://blogs.msdn.co...every-time.aspx


Thanks, shawn hargreaves even says to do that! So this isn't some workaround, it's just what the content pipeline does for whatever odd reason.


[font="Arial"]

> Is there a way to tell VS 2k8 not to rebuild every time a specific reference rebuilds?

[/font][color="#333333"][font="Arial"]

Sure: just unload whatever projects you don't want to rebuild, or mark them not to build in the Visual Studio Configuration Manager.

[/font][color="#333333"][font="Arial"]

[/font]


But he doesn't mention the step for when you need to update the output of the library. Well, that's because the project I set to not build was the project that created the game executable.

Share this post


Link to post
Share on other sites

[quote name='Starnick' timestamp='1324833576' post='4897303']
Might want to give this article a look at:

http://blogs.msdn.co...every-time.aspx


Thanks, shawn hargreaves even says to do that! So this isn't some workaround, it's just what the content pipeline does for whatever odd reason.

[/quote]

Yes, but he also gives some suggestions of possibly refactoring how your project's setup to avoid rebuilding :)

I remember this was always a trouble for me too - another thing to remember (I don't think this was covered in the above link or if you do this, but it may be a helpful tip) is that you shouldn't add textures to your content project that are referenced by your model content, otherwise they get built twice.

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!