Live data from Hacker News

Why is C++ still a very popular language in quantitative finance?

quant.stackexchange.com

1–10 of 51 posts

Re: Why is C++ still a very popular language in quantitative finance?

#4
And by the way, for the typical user, the performance difference between C++ and, say, C# won't be as pronounced (F# is another matter, though).

If you include memory usage in your performance comparison (which is very important for parallel programming), C++ is leagues ahead.

Re: Why is C++ still a very popular language in quantitative finance?

#5
For applications bottlenecked by memory performance, like most analytical databases, C++ will often be faster than a language like Java by an integer factor. When people assert Java is about as fast as C++ they are talking about CPU-bound tight loops and similar. It is difficult to make languages like Java approach the memory efficiency of C++, hence why C++ is significantly more performant for applications bottlenecked on the memory subsystem.

These days, more performance-sensitive codes are bottlenecked by memory performance than by CPU performance. The throughput of CPUs has grown faster than our ability to keep those CPUs fed from memory. In the supercomputing world this started to become evident years ago; memory benchmarks like STREAM became more closely correlated with real-world performance than CPU benchmarks like LINPACK for a great many algorithms. The resurgence of C++ is partly driven by this reality since it makes memory optimization relatively straightforward.

Re: Why is C++ still a very popular language in quantitative finance?

#6
There are a bunch of really expensive, really useful, 3rd party libraries for financial modeling that are written in C++.

A great many languages have support for calling external code, but debugging the interaction tends to be more trouble than it is worth.

Re: Why is C++ still a very popular language in quantitative finance?

#9
It appears to be mostly inertia. People learned C++ and a few relevant specialized libraries, so they keep on them.

Outside of a few relatively narrow topics like high frequency trading, trading algorithms for direct market access and solving optimizations, the speed of C++ is not needed. As a result I am observing more code development occurring in higher level languages such as Python, R, Matlab and SecDb/Slang. Extremely time or latency sensitive tasks are offloaded from these scripting languages onto broker algorithms or other third party libraries.

Re: Why is C++ still a very popular language in quantitative finance?

#10
post #4

And by the way, for the typical user, the performance difference between C++ and, say, C# won't be as pronounced (F# is another matter, though). If you include memory usage in your performance comparison (which is very important for parallel programming), C++ is leagues ahead.

I totally agree, and I have complained about Java's lack of structured value types many times before because they are the main reason for Java's crazy memory usage.

However, the gap has narrowed significantly with the introduction of pointer compression in Java. It only works up to 32GB though, so this is going to be a temporary boost for Java I guess.

Post reply on HN