ArticlePostHistory

Another approach to use Python and C/C++ at the same time is to embed the Python interpreter in your C/C++ program. That is easier to do than writing a module, and it has an advantage, you can completely deactivate the Python interpreter in some cases so you can have parts of the program that are super fast. This is the approach used by most game developers. Ruby, Lua and even some home-made scripting languages are used too.

An alternative is to use some language in the middle of the performance scale. If C and C++ are fast, Python and Scheme are slow, the middle is: Java and C#. I've heard of Java code running extremely fast. As fast as C++, but with a memory penalty. Interoperability between languages is also easier thanks to the JVM/CLR, so you can combine Python and Java/C# and the result will be faster than the previous approaches. For parts of the program where performance is critic, you can still use C/C++ via JNI/PInovoke. JNI is the Hell, but SWIG can be used, PInvoke is much better. Anyway, the only cases where this would be needed are when you have to use SIMD instructions or something like that.

ceronman, Tue May 29 18:42:32 2007


Hey, yes. Using extension languages is the way to go.

arhuaco, Tue May 29 22:19:28 2007

Comment:

Identity

Please enter your name, to associate it with your changes:

Author:

Spam control

Please answer the following question:

4 + 7

Email address

Enter your email address if you want to subscribe to this page:

Email address(optional):

Last update: 2008-11-13 (Rev 14708)

svnwiki $Rev: 14721 $