I'm currenetly struggling with choosing how to proceed as a programmer. I mainly programmed games and would like to continue. And for about 5 years or so I just used C++ and OpenGL, so I spent a lot of time on infrastructure, strange bugs, and mostly getting basic things to work.

A friend of mine then recommended python and after initially being aversed by it being not as explicit and formal as I was used to I was shocked by how much more productive I could be and how much progress I could actually make in a very small amount of time.

So currently I'm working on a multiplayer-shooter and repeatedly I find myself struggling with python being not as fast I might want it to be. I know that that I have to approach writing efficient code in python very differently now, but even with a little help from friends that are more experienced with python there is just too much going on sometimes (and extrapolating this, I know that I will end up stuck).

There are a lot of things I really like about my "home-language" C++, but after knowing how many hours I could be wasting I don't really want to go back.

What language can you recommend which offers high-productivy, is memory-safe (I really hated this) and as high-performance as I can get, but is still mature enough to be used for kind of serious projects (games-related) and maybe even mature enough to have people already having spent some time on OpenGL-Bindings or various libraries for Sound and similar (alternatively easy access to shared libraries written in C). Easy cross-plattform is a big plus! So no .NET please. Is this even possible?

closed as not constructive by Robert Harvey, user40980, gnat, dan_waterworth, Joris Timmermans May 6 '13 at 8:37

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 5
    .NET is easily cross platform these days, take a look. – Telastyn May 5 '13 at 23:54
  • 2
    Instead of looking for another language, have you first considered profiling your code for 'hot spots' and rewriting those spots in a C binding so as to improve the speed? – Casey Kuball May 6 '13 at 4:11
  • 3
    questions about what language you should learn next are off-topic per site FAQ – gnat May 6 '13 at 5:49
  • More productive/safe than C++, but without Python's performance 'characteristics'...... OCAML !!!!! – J. M. Becker May 15 '13 at 20:58

I would say stick with Python and use some of the advanced features it provides. Specifically I am talking about the extensions. If you look at how things work today there are some very fast things in Python and those things are all done in C/C++ as extensions.

You can create C/C++ extensions to speed up the slow parts of Python. Additionally a good intermediary position would be to use Cython to get some decent speedups.

Cython This provides a way to tweak Python code to make it run faster. The basic idea here is to realize that one of the very slowest things in Python is typing as well as one of the most powerful. Cython gives you the ability to specify the typing of variables in order to speed things up. Here is a great example: Cython Example

Extensions The next step if Cython doesn't speed things up enough is to create a straight C/C++ extension. What this means is that you can create a custom function that will greatly speed things up. Look for the most CPU intensive parts and implement them in C++ while keeping the other abilities of Python.

My Personal Experience I created this IO tool to test asynchronous IO in Python that was very powerful. It could do all sorts of things including data integrity checks. This meant that I could write data out and then later verify it. My problem was that Python allowed me to very quickly create this program but because of Python the data integrity section was very slow. It was so slow that it would consume all of the CPU and bring the system to a crawl. In order to solve this and make the program usable I thought about recreating the program in C++. My problem was that every time I looked at what I would need to do the problem looked staggering and not worth the effort. After some time I looked around and found Cython. It was a good intermediary solution. I implemented the slow Python code in Cython and found that I got some large performance improvements. After a while I still ran into the problem where things were slow so I created a C extension. This extension then allowed me to realize my dream.

PyPy I have heard, although never tried, that PyPy is a much faster implementation of Python which might give you the performance you desire while still using Python.


There are lots of options to be considered once you find that scripting languages are not just toys.

Personally, I'd suggest:

  • Lua: very fast for a bytecode interpreter, much faster with LuaJIT (seriously, it challenges good C compilers), easy to mix with C code (either embedded in an application, or extended with C modules), minimalistic core/libraries, very portable (pure ANSI C), widely used in game industry.

  • Go: static typed, compiled, no bytecode. Garbage collection, type inference, modern threading. Designed by C++ programmers that wanted something more productive but loved by Python programmers that don't hate static typing.



High productivity. It's in the Pascal family, which was designed to be easy to read and write, with some very well-thought-out standard libraries available.

Memory safe. Not completely (it's hard to get that without managed code) but far better than C++, with a stricter type system, bounds checking at the language level and a debugging memory manager available on SourceForge that makes tracking down whatever gets past the first two safeguards simple.

As high-performance as I can get. It compiles to native code, and has been used to build games before, including some rather high-profile titles like Age of Wonders and the Space Rangers series.

Still mature enough to be used for kind of serious projects (games-related). Delphi was first released in 1995 (the same year as Java) as an upgrade from the already-mature Turbo Pascal product, and has had a strong community behind it ever since.

Mature enough to have people already having spent some time on OpenGL-Bindings. A basic OpenGL header implementation comes with the standard library. A more extensive GL header unit can be found as part of Asphyre, an open-source multimedia library for Delphi tailored towards game development.

Alternatively easy access to shared libraries written in C. Delphi actually makes it easier to talk to C-based DLLs than C does, as it has no need for .lib files; all you need is a translation of the headers. Also, Delphi header translations for various multimedia libraries exist, including the popular game-development framework SDL, which I have contributed to personally.

Easy cross-plattform is a big plus! Delphi is still primarily a Windows development platform, but they recently released compilers for OSX and iOS, and they're currently working on an Android compiler as well.

Is this even possible? Yes. It's not perfect, but it's possible, and it works pretty darn well.

  • 3
    Embarcadero hasn't managed to kill off Delphi yet? I'm a long-time fan of Turbo Pascal and the first versions of Delphi, but after Embarcadero took them over I went to .NET. I had a look at their current web page and like what I see, but I'm wary. – Robert Harvey May 6 '13 at 3:45
  • @RobertHarvey: People have been predicting Delphi's imminent death since it first came out in 1995. It's still around and going strong. – Mason Wheeler May 6 '13 at 4:30
  • I never liked the shift toward "expensive" products that they took. Not much in terms of entry-level. If they had kept that around, the product would be much more popular. Loved Turbo Pascal back in the 80s. – MetalMikester May 6 '13 at 11:10

You should be happy with both. Use python where you want to be highly productive (your words) and use C++ where you need high performance. If you need even higher performance, use more specific language (e.g. fortran), wrap it and call it from your python code. Need even speedier code, hand code some assembly. Maybe you don't even need to do that, maybe using language that supports concurrency pays more dividend.

It's about using the right tool for the job. You don't need to optimise everything, just where it really counts.

If you really want to only know one language, probably ruby is the answer. Just because you get 'rake' for 'make' replacement. You can have client, server and deployment scripts all in one language. Otherwise use a few languages.

  • As much as I like Ruby, I don't think it would meet the author's performance needs without interop with native code. – jhewlett May 6 '13 at 3:01

If you're working as part of a team; ask your team members. Nothing is worse than some rogue programmer deciding to write a piece of code in some language that nobody else knows. It's best for the entire team to agree on a small number of "right tool for the job" languages that everyone (or almost everyone) has experience with, and stick to them. Note: Having experience with a language is very different to merely knowing a language.

If it's just you (no team, and nobody maintaining the code for however many years after you're done); then I'd recommend using whatever you're most productive with (e.g. Python) then, after pieces work and after you've found the bottlenecks, rewrite the "not fast enough" pieces in a faster language (e.g. C++). Finally, after everything is done and everything is fast enough, think about minimising your software's dependencies (e.g. consider replacing any/all code that's still in Python so that your poor end users who are unlikely to have Python installed won't end up with unnecessary hassles).

  • So why not just write everything in C++ in the beginning if you're planning on replacing it? – jozefg May 6 '13 at 21:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.