About compilation time

Hi community, i’m new here and i’m trying to use panda3d, i like its results very much.

This post is to know if there is a way better to compile, run and test panda3d c++ applications.
At the moment, i’m using visual studio 2008, all fine.
My computer is: Dual CPU E2200 2.20Ghz,4Gb ram.
Problem is I like execute every single change of code and every compilation consumes a lot of time.
Can i do something to cut this time? Is it normal?
Maybe i’m missing something, or not.
Well thanks in advance and hello everybody.

I’m not sure what you mean. It shouldn’t take more than a few seconds to compile your application, unless your application itself is very large. You don’t need to recompile Panda for every change to your own application.

What part of your process is taking a long time? How long is “a long time”?


I mean, any change on code is a new compilation. 20 seconds a compilation, so 30 compilations takes 10 minutes. I’m starting using panda3d from 0, so with trial and error i lose a lot of time.

It’s a win32 project wich uses WinMain to not show console.

Process starts with:

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
	return 0;

mainPanda is Panda3D Hello World Tutorial.
And thats it. For sure I’m not used to 3D applications with VC++, sorry.

20 seconds seems a bit on the long side, though I suppose it’s possible, depending on your computer configuration. But have you considered developing in Python instead? Not only is there no compilation step, but it’s possible to modify your application and see the results immediately without even stopping the program!


I never used python but want to learn it, sounds awesome. I went to python site and first step of tutorial says:

So I’m going to do an effort with python, let’s see what happens. Thank you

By the way, how to update a program on real time?

Your initial instinct was right, you can (and must) configure Visual Studio to build in sub-seconds time, cause by default it will take 20 seconds as you say and that is a pain, David must have a very fast machine or he has tweaked it like I’m gonna tell you and he forgot about it. Anyway.

  1. You want to create two Release profiles, one real with all the optimizations for when you release the finished product and one created by you called ReleaseFast or something like that that you’ll use for your daily development. In this profile you want to disable all optimizations for compiling and for building. Basically set code generation optimization to none and disable linking time code generation from the top of my memory. This will make compilation a little faster and linking much faster, like 15 times faster.

  2. You have to use the precompiled headers feature of visual studio. What I do is I create a header called precompiled.h and in all my .cpp files the first line has to be #include “precompiled.h” or else it won’t work. In precompiled.h add all the includes that are not part of your application (be it Panda includes, stdlib includes or includes or 3rd party libraries). Then you have to go to the project settings, precompiled headers, and set the default to “Use precompiled headers” and set the precompiled header include to “precompiled.h”. Then you have to add a precompiled.cpp to your project that includes that file and only does that. Go to the properties of this file in your project and this time select “Create precompiled header”. Meaning: this file in your project will create the precompiled header everytime precompiled.h changes, if you don’t change it it won’t be built again and compilation will be instantaneous. If you don’t understand anything ask me, it can be confusing at first.

  3. Other thing you’d want to do is make panda start faster, so that you don’t waste time on every test run, I quote myself for this:

Doing these things my app builds and starts in 0.5 seconds in my Q6600 with 2 gb of ram as long as I haven’t changed precompiled.h which doesn’t happen a lot. Even when I change precompiled.h it’s still quite fast cause of the disabled optimizations.

Also that manual quote is blatantly misleading, it was obviously written by somebody not very familiar with C++ ides and I’m gonna delete it. In my machine starting the python interpreter that comes with Panda is slower than building with precompiled headers. There are advantages to Python but this isn’t it.

EDIT: Ah it’s not a quote in our manual but in Python website, that explains it. I thought it was talking about Panda.

EDIT: I forgot:
4) Start your app with ctrl+F5 instead of F5 if you don’t want to debug it.

What can i say? Amazing buddy, now it’s instant. Very helpfull. Thank you very much!

Edit - Buddy with crt+f5 it’s faster than light. Perfect. From 20 secs to 0.