Hacker News new | ask | show | jobs
by wealthyyy 1916 days ago
Accenture used C# for a HFT shop but that shop went away from it to C++.

Java is not popular in HFT other than 2-3 shops using it.

C++ is best choice IMHO. It has become easy to use it and plus you can get compile time branch prediction with templates.

RAII also amazing. RAII looks like a GC but it's not but it's works like a GC ..

1 comments

What do you mean by compile time branch predictions?
You pay cost for branch predictions at Runtime. You can avoid it at compile-time using Templates or even constexpr. .
I still don’t understand what you mean, please correct me where I’m wrong.

Branch prediction is a CPU level thing, and mis-predictions has a cost. You can do things like partitioning data beforehand so that a given if condition will take the same branch each time in the partition, but I don’t see how does it apply to templates at all.

You can’t avoid branches that depend on runtime infos, and those branches that depend on compile time known infos can be elided either automatically by the compiler if it can prove it is constant for example, or by things like constexpr, templates as you say. But it’s nothing too fancy, the dumb C-preprocessor macro can do similar things.

JIT-compiled languages can sometimes elide branches based on runtime data, so there is that.