Hacker News new | past | comments | ask | show | jobs | submit login

There is much hype now with going 'back to basics'. You get more cred saying you are building things in C or C++ then you do if you are building them in C# or similar 'new' languages.

However, one big fact that is being left alone here is that there is no inherent speed bonus in using C, C++ or ASM over C# for most cases.

C++ apps can be faster than C# by a good margin, but you need to be able to program better in C++ then the C# compiler does in translating your good C# code. Simply writing in C++ != faster code. You have to beat the machine.




I don't think it's about "going back to basics". I think that companies and other organizations are just fed up with what they get when they don't deal with C++ and C++ developers.

If they choose Java, they often get a slow, bloated, extremely over- "engineered" system. Although simplicity is often given as one of the reasons for using Java over C++, the complexity of these Java-based systems often far exceeds what we see from even large C++ systems.

If they choose Ruby, they are almost guaranteed scalability problems if the software is to be used by a large number of people. The effort and cost needed to scale a poorly-performing Ruby on Rails web application, for example, can exceed that of using a language like C++ in the first place.

When it comes to other languages, it may be difficult to find talented developers. This can pose big problems when it comes to maintaining software systems written in a more obscure language.

C++ has time and time again shown itself to be a safe bet. There is a large, experienced and global developer community. There are ample resources and tools available. It is extremely well proven, even for absolutely massive systems. Systems developed using it usually perform quite well without much effort.

It offers a better set of trade-offs than other languages. While it may take longer to develop a system using C++, there is often at least equal, if not much greater, time saving in other respects. Avoiding scalability and portability problems alone can offer massive savings.


With regard to java, a lot of the complexity is in ancillary systems rather than language or the libraries themselves. You may not like Maven, for example, but what's the c++ equivalent? Autotools? I think not. Any cross platform c++ project immediately falls over the build system problem before you write a line of code, and most of the time we choose a non-native, underperforming solution (eg. MinGW on Windows) - anything for a quiet life. Honestly, Java would be a better answer.


cmake or bjam


"When it comes to other languages, it may be difficult to find talented developers" I disagree. Actually it is harder to find good C++ devs than to find good C# or Java devs in my region. There are lots of poor C++ devs out there, who learned only the language taught at the university (C / C++) and who really can't code.


Are we talking about native C++ or C++ with all the .Net stuff? ;)

Two years ago I have heard about many benchmarks, people saying that higher level languages can be nearly as fast. (Or even faster!) In fact I even believed this because it was said so often and Ruby for instance went fast.

However reality proofed me wrong. When the CPU is going to 100%, C/C++ are always faster. (In case of Ruby it can be orders of magnitude...) However when doing mostly I/O-intense web apps, it pays to have a language that makes performant design easy.


Ruby seems like a bad basis of comparison, as it appears to be designed without concern for runtime speed at all and the main implementation uses a slow, simple design. High-level languages in general can be very fast, but it doesn't mean any particular one is.

C# and Java can produce very efficient programs, and for a lot of CPU-bound problems the obvious solution in either of those will be faster, particularly stuff that needs to perform lots of little allocations or where the obvious C++ program does too much accidental copying.


Once I worked on a C++ program and when we really had to optimize, I did some profiling with valgrind. It turned out more than 50% of the CPU time was spend with memory allocations...

However with C++ it's easy to work around that by using pointers or (const) references. Or even one step further one can use a memory pooler or GC.


Some real world applications (not microbenchmarks) show it is possible to get on par with C/C++ performance when using Java.

- Netty vs Nginx - Tomcat vs Apache - Jake2 vs Quake2 - H2 vs PostgreSQL (there is no clear performance winner here)

However, to achieve good performance in high-level languages, I'm afraid you still need a pretty deep low-level knowledge, so learning C can be very beneficial.


You might find this interesting: http://page.mi.fu-berlin.de/prechelt/Biblio/jccpprtTR.pdf

"For all program aspects investigated, the performance variability due to different programmers (as described by the bad/good ratios) is on average about as large or even larger than the variability due to different languages."

But I still wouldn't discourage people from learning C and C++. They're not magical fast code juice, but being able to work closer to the machine when it does make sense is obviously better than not being able to. All of the good programmers I know personally can work in at least one of the two.

Besides, people deciding to learn C and C++ just might become good enough to beat the machine after all.


I think it's not only about being faster, but about having more control. If you actually want to write something for a machine, not a virtual one, you use C or C++.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: