I am considering writing a new software product. Performance will be critical, so I am wary of using an interpreted or language or one that uses a emulation layer (read java).

Which leads me to thinking of using C (or C++) however these are both rather long in the tooth. I haven't used either for a long time. I figured in the last 20 years someone has probably created something which is reasonably popular, nice to code in and compiled.

What more modern alternatives are there to C for writing high performance compiled code?

If C++ is a different beast than it was 15 years ago, I would consider it, I guess I had an assumption that it had some inherent problems.

Parallelisation would be important, but probably not across multiple machines.

  • 23
    Modern C++ is radically different than C. It's much more comparable to something like Java or C# than it is to C, except it features deterministic destruction instead of garbage collection, and also has undefined behavior since it doesn't run in a VM or managed environment. Your other alternative is D, which is a decent language, but still very immature in terms of libraries and support. – Charles Salvia Aug 28 '12 at 13:44
  • 12
    Can you elaborate on the "performance will be critical" part? Why will it be critical? Have you measured anything yet? – JesperE Aug 28 '12 at 14:32
  • 3
    15 years is an eon in computer terms and for as long as that, people like Ericsson have been using functional languages like Erlang to support distributed, fault-tolerant, soft-real-time, non-stop applications in their embedded systems! Don't assume only C++ can give you the performance you want, you may be better off throwing more hardware at the problem and saving yourself a lot of implementation time with another language. – Mark Booth Aug 28 '12 at 14:38
  • 6
    @JeremyFrench: but you're asking question based on false assumption, that performance => static compilation. – vartec Aug 28 '12 at 15:28
  • 4
    For what it’s worth, Haskell currently serves as my replacement for C++ in most cases. – Jon Purdy Aug 29 '12 at 0:13

12 Answers 12


There is a language in development called The Rust Programming Language which pursues similar goals as C++ does, notably zero-cost abstractions and fine control over memory management. That said, it is perhaps the most notable upcoming candidate despite being still very young.

Apart from Rust there really aren't any other popular alternatives which compile to native code. There's Delphi and D too, of course, but they aren't as fast, popular or used. Google's Go language could be a candidate, but it's still very young and aims for a bit different domain.

However, do note that C#(assuming Microsoft platform) and Java might not be all that slow even though they run on top of a virtual machine; the just-in-time compilation of code can do some optimizations which traditional ahead-of-time compilers aren't capable of applying due to lack of information of the program state and environment.

Frankly I would personally not consider C to be a candidate if C++ is an option, mainly because of the fact that modern C++ is safer, works at higher level of abstraction, is more expressive and has practically no performance loss over C(in some cases C++ is notably faster). Simply put, C++ provides everything that C provides and more. Most of the C functionality is considered to be "deprecated" and better, safer, faster and more intuitive alternatives are provided by the C++ standard library.

  • 5
    I wouldn't say the C functionality is "deprecated", in an official sense - just that there's almost no reason to ever use C library functions, raw pointers or C-arrays in C++. – Charles Salvia Aug 28 '12 at 13:54
  • 23
    +1 for talking against the 'compilation is required for performance' false assumption. – Telastyn Aug 28 '12 at 14:11
  • 3
    @gbjbaanb try to compile with Visual Studio and with MinGW under Windows and good luck with that :| try also to convince a person that gives you a compiled library compiled with one of this tools that doesn't know nothing about ABIs that he is wrong and he should give you the source of that library or learn how to recompile and give the right specs. the horror, sometimes. – user827992 Aug 28 '12 at 14:52
  • 5
    @paxRoman: you can write small programs in C++, and write them more safely than you can in C. – kevin cline Aug 28 '12 at 17:22
  • 3
    @JBRWilkinson As far as I'm aware, Objective-C's popularity is non-existent outside Apple's platform. – zxcdw Aug 29 '12 at 14:34

If C++ is a different beast than it was 15 years ago, I would consider it, I guess I had an assumption that it had some inherent problems.

15 years ago, there was no C++ standard. The second one has been published last year. C++ best practices changed a lot in the 5 years after the publication of the 98 standard, and they are changing again with the publication of the 11 one.


There is also Ada, which compiles to native code, and is portable across various platforms within the limits of its standard library. The language is alive and well, with the most recent language standard update currently underway (known as Ada 2012).

Quick summary for those unfamiliar with Ada:

  • Strongly-typed
  • Built-in support for concurrency
  • Object-oriented or procedural, depending on your requirements
  • Supported by GNU toolchain (GCC contains Ada frontend)
  • Excellent also for software development, i.e. when you need to directly interface with hardware
  • Supports generic programming (generic packages, procedures, functions)
  • Features support large-scale software development (packages, child packages, separate compilation, strict distinction between specification and implementation)
  • 1
    Not to mention Ada Tasks (Parallelisation!) – NWS Aug 29 '12 at 13:18
  • 6
    +1: I have tried to learn some Ada and I think it is a very robust and clean language. A pity that there are not so many jobs as for other programming languages. – Giorgio Aug 29 '12 at 13:32
  • 3
    Good mention, I was looking for something more 'modern' but I had forgotten about Ada – Jeremy French Aug 29 '12 at 16:44
  • 4
    @Jeremy French: What features are you looking for in a more 'modern' language that Ada does not offer? – Giorgio Aug 30 '12 at 20:35

C/C++ is rather long in the tooth.... this is a good thing. It implies that they were designed well enough (ahem) that they are still very usable, that many people use them for everyday tasks, and that you will find a large body of developers whop are experts in them. Maturity is something to be treasured.

If you spend all your time looking for something new, just because its new and think therefore that is must somehow be better, you're in for a lot of disappointment. This applies to software languages, GUI systems (take note, Microsoft and Gnome) and lovers (take note, young ladies :) )

Now admittedly, if your experience of C++ is 20 years old, when C++ code was generally coded like C, then maybe its time to re-evaluate the language, all the features that were there in the day that were never quite used are used a lot more today, and a few standardisation efforts have expanded the language a little to make it appear much different from those old C-style developments. Not that C is bad too - its a perfect language for many types of coding task too!

  • 17
    I think C and C++ exemplify Hoare's comment on software design: either make it so simple there are obviously no deficiencies, or make it so complicated there are no obvious deficiencies. – TMN Aug 28 '12 at 14:50
  • 1
    How are repeated security vulnerabilities due to some form of buffer exploit a "good thing", regardless of how old or entrenched a language is? And, is this really different than arguing continuation of an established marriage after repeated abuse? – user2864740 Feb 27 '17 at 18:45
  • @user2864740 what you're suggesting is get a divorce because the wife is old and you want a new, exciting model... I say you stick with what you have because you know the foibles and quirks. How many of the new, cool, languages solve problems like buffer overflow and then turn out to have subtle ways of overflowing buffers? So what's better - the overflow you can avoid by not being lazy or using the right construct, or the one that you fall into because you didn't know was there? – gbjbaanb Feb 28 '17 at 12:42
  • 1
    @gbjbaanb No, I never said that. I was drawing a simile specifically to damage caused by not improving the context of situations. I'm generally quite rational and not prone to "fanboi" selection of trending topics or tools (this is just my nature). Furthermore, C and C++ are different languages; yet they are both justified for the same blanketing reason. And that is the problem with such. – user2864740 Mar 3 '17 at 19:29
  • @TMN So where do you see C++ there? – gnasher729 Jul 20 '20 at 8:25

Why people always insist on looking for new languages?


  • Is the number 4 language by TIOBE, but stomps all competition if combined with C
  • Has lots of frameworks
  • Is very easy to code in
  • Is very easy to tune
  • Is very performant
  • Is very safe
  • Has a very good industry support
  • Is cross platform
  • Doesn't need extra VMs/Frameworks/deployment mess if done correctly
  • Will easily land you a job
  • Has all the necessary stuff to build .so/.dll to launch on very old systems
  • Easy to troubleshoot
  • Very expressive
  • Very dynamic
  • and bunch of other interesting stuff

The only downside of C++ is that you have to learn a bit. That's it.

Compare that to other languages which are one or more of:

  • Narrowly supported (OCML, Fortran, ...)
  • Slow (Java, Javascript)
  • Experimental (Silverlight)
  • A moving target (.NET 1/2/3/4/5? which one is the last one now?)
  • Platform locked (.NET)
  • Have poor framework support (Fortran)
  • Has small communities (anything outside top 10)
  • Are nightmare to troubleshoot (Anything with high-level fool-proof concepts and stuff)
  • Needs 500MB of preintallation on customers machine (JVM/.NETVM)

IMHO, the less languages we will use and support, the better the situation will be.

This causes automatic improvements in frameworks for the language, support, documentation, standardization committees work, better books, more knowledge, easier to support software, better patterns, longer language support cycles and more skilled code written in the language.

I know people will downvote this, but think about it, really.

  • 77
    C++ “is very easy to code in” is just ridiculously wrong, sorry. It’s an incredibly hard language to learn and even if you use modern C++ idioms and eschew pointers you will be faced with tons of puzzling compiler and runtime errors before getting the hang of it. And even after you’ve mastered it, the syntax gets in the way quite often. Safe C++ often uses a mess of nested templates which generate huge amounts of boilerplate code. – Konrad Rudolph Aug 29 '12 at 10:02
  • 22
    Very expressive and very dynamic do not sound like typical C++ traits, comparing to dynamic languages. – vartec Aug 29 '12 at 11:34
  • 30
    @gbjbaanb “slightly more difficult to learn” is, once again, ridiculously off the mark. Sorry. I’ve been programming all those languages for years, I clearly prefer C++ (and do most serious programming in it) but saying that it’s easy is just totally misleading. And I’m not talking about fancy metaprogramming stuff, I’m talking about compiler errors produced by run-of-the-mill code, caused by name hiding, ADL, const correctness issues and stuff like that. Anybody who has read Effective C++ (as Coder claims to have) and maintains that C++ is easy has a mental disconnect. – Konrad Rudolph Aug 29 '12 at 13:56
  • 13
    @gbjbaanb I’m a C++ programmer. Once again, I don’t think C++ is easy. And this comment thread got some frowns from the C++ chat as well. So it’s not that. And the difference between C++ gotchas and other languages’ gotchas is that if you don’t know about them in other languages, you’ll probably be fine. In C++, you’re toast. And even if you know about them, you can still get several screen pages of compile errors for a single error (happened to me again today). And even though the error was simple to fix (a typo), it takes time to parse through all that. – Konrad Rudolph Aug 31 '12 at 18:58
  • 6
    When has a popular language ever been good? PHP is hugely popular and no serious person thinks it's a "good" language, even for its niche. The only "good" thing about popular languages are that there are lots of libraries to make certain domains easier to program in. C++ itself is fraught with frustration. – weberc2 Jul 2 '13 at 14:37

I am not a big expert of this language, but I think OCaml could be an interesting option to look at.

OCaml is a compiled, functional / object-oriented language. For a performance comparison with C++ see C++ vs OCaml: Ray tracer comparison. Of course, this is a very specific example and one should do more extensive testing to have a better feeling of OCaml's performance.

  • Can the downvoter please give a hint as to how this answer can be improved? Thanks. – Giorgio Nov 20 '16 at 10:38

Current standard of C++ is C++11, which was published in 2011. So it's not 20 years old standard. And there have been numerous standards in between. Each of them introducing numerous performance improvements.

Compilers also have been constantly improving. They are far better at optimizing, than they used to be.

Executable formats have also improved, 20 years ago you had a.out, now you have ELF.

Overall, suggestion that C++ didn't change in 20 year cannot be further from the truth.

Also, keep in mind, that C and C++ are very different languages.

  • 2
    My assumption was that something that was first conceived 20 years ago would have inherent architectural limitations which could only be improved with a blank slate. I think this assumption may have been wrong. – Jeremy French Aug 28 '12 at 15:50
  • 4
    @JeremyFrench: Like the x86 architecture? – TMN Aug 28 '12 at 16:14
  • 2
    @TMN is that proving or disproving my assumption? – Jeremy French Aug 28 '12 at 16:17
  • 6
    The original x86 architecture was a nasty compromise between backwards compatability with the 8080 and a set of features to compete with the 68000 and NS32032. Segmented memory (with "far" and "near" pointers), only 4 general-purpose registers, variable-length instruction encoding, over 50 flavors of JMP instruction, a multiplexed tri-state system bus... And yet today, that same basic design is going stronger than ever, after many "superior" clean-slate designs (Alpha, MIPS, PowerPC) failed to displace it. – TMN Aug 28 '12 at 17:27
  • 1
    @JeremyFrench nope, your assumption was not wrong, at least in the case of C++. C++ 11 features are definitely useful; however, at this point they are just more crap on the crap pile. They try to build in features of modern languages, but to cope with the existing C++ mess, they must have exceptions, and those exceptions will have exceptions and so on and so forth. – weberc2 Jul 2 '13 at 14:43

When you say your project is performance sensitive, do you mean every line of code of it? Or, like normal, is there a smaller percentage that is performance criticial while the rest of it is your ordinary run of the mill business code?

After you answer that, what is the bigger risk for your project: that the end result is too slow, or that you never finish it in the first place?

Assuming you answer the second for both, you should develop in a higher level language that supports native interop (Python, Ruby, the .Net Family all have this). First, finish the project. Then profile, optimize, rinse, repeat. Only after that, consider reqriting choice segment of your application in native code and integrating that native code with your finished product.

  • Once it's Java, you can't salvage it if it's too slow. – Coder Aug 28 '12 at 22:51
  • 6
    @Coder Java has a FFI (JNI) which allows you to 'wreak havoc' in your language of choice. So if you have designed the interfaces well, you can just replace a Java implementation with a native one. The Java platform is well thought. – K.Steff Aug 28 '12 at 23:38

Depends on what your product is going to do. If performance is really critical, then the go-to language of choice is still FORTRAN. I also wouldn't rule out Java -- it's used in many high-volume financial trading applications. Erlang is worth a look if your problem domain requires high concurrency. Objective-C is nice, although I don't know how well supported it is outside the Apple ecosystem (beyond compilers and basic runtime). I've also heard good things about Haskell's performance, but I'm not sure whether that's absolute performance or just performance relative to other functional languages.

  • 2
    every finance job I've looked at want C/C++ developers, not Java. From experience with Java, I can't see any that are high performance unless you throw masses of hardware at it. – gbjbaanb Aug 28 '12 at 14:47
  • There are a lot of Java trading systems in operation on Wall Street and at various investment banks in the US and UK. It's also used pretty heavily at the Chicago Mercantile Exchange. – TMN Aug 28 '12 at 15:04

I've never used it, but a friend of my swears by Cython which lets you use C style primitives in performance critical parts of your code while keeping the general python syntax and being able to take full advantage of pythons higher level constructs to reduce development time everywhere else.


Vala is similar to Java and C#, compiles to native code (or C source code if you prefer), and is very fast. It does require GLib for its object-oriented bits, and it's written by Linux hackers for Linux hackers, so if your domain is Windows it may not be very good.


Objective-C is modern, compiled alternative to straight C and C++. It has both garbage-collected and deterministic memory management and the message-passing OO runtime has been optimized for performance.

It is available through GCC and CLang and there are application libraries such as GNUStep and Cocotron which work on various platforms.

If you're doing high-performance work, I'm going to assume that's kind of number-crunching or other divide-and-conquer work instead of UI, so that means you could do the UI in whatever language is easiest for you, e.g. HTML via a mini http server.


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