python performance for huge projects

I need to consider Panda3D for a complex and huge project. There will be lots of logic, 3D data and lots of calculations. I know I can access Panda3D from C++ too, but I want to code specifically in Python. Please suggest how does Panda perform with Python and is Python recommended for large projects?

We use panda3d and python in our project and it’s becoming quite big. With no problem.

Progressively, we convert to c++ the part of our code that create bottleneck ( which mean all the computation heavy stuff)

In the end, we gain a lot of time with this method ( coding in python -> identifying bottleneck -> convert to c++).
We get the simplicity of python, and fast enough code.

The size of the project has nothing to do with it.

This is exactly Disney’s strategy also. Panda + Python was specifically designed for big projects; witness Disney’s two MMO’s using Panda + Python. The use of Python enables larger projects than would otherwise be possible for a given programming team, because Python speeds development time.


thats kewl, though i’ve heard lots of horror stories about python being slow on array access and math calculations.

It is. So, don’t use Python for heavy math calculations. :slight_smile:


Use python, is written in the manual, with c++ you could not get a big speed up, is the same (globally speaking), you can use python in calculations too with psyco, this will speed up the process. Yet, don’t forget panda core is written in c++, so at least is even fast.

Some benchmark show that python is about 150 times slower than c if you asking him to do the base of 3d calculation.

It’s a lot. But that’s doesn’t mean you can’t use python for these.

For example, We use cgKit, numpy, … that allow use to use only python without loosing too much performance.

And like I said, sometimes you have to convert thing into c++, once you know which part and how it’s really used.

I really think python encourage you to do good programming, in a sense that you must not optimise without identifying your bottleneck first. You have clear, understandable code, and easily modifiable.

This was a message from the python fan club. :smiley:

And I must say that Panda3D implements a lot of complex calculations in C++ that you can easily make use of, from Python code.

What is average cpu time for numpy compared to c/c++?
Double, more , less?

I haven’t really test.
But It should be enormous, depending on what you do: numpy is entirely in c/c++, it converting information for you in python that cost a lot.

so if you have your information and start a heavy calculation it’s about the same. but if you constantly get the information back and start other thing ( even if the python part is really small) then it will cost a lot more.