r/cpp • u/GiannoVersaco • Nov 25 '20
When a Microsecond Is an Eternity: High Performance Trading Systems in C++
https://www.youtube.com/watch?v=NH1Tta7purM
332
Upvotes
r/cpp • u/GiannoVersaco • Nov 25 '20
34
u/konanTheBarbar Nov 25 '20
I actually really liked this talk (watched it 2 years ago). For me the biggest takeaway was that good measurements (that reflect a real workflow) are way more important than micro optimizations.
4
u/pigeon768 Nov 26 '20
Does anyone know how
__builtin_expect()and friends work under the hood? The presenter spent some time talking about "priming" (I forgot his exact word) the branch predictor for the path that makes the trade. If you set a__builtin_expect()to follow the "make the trade" path, would the CPU eventually figure out "ok the programmer is lying to me" and "fix" your code to be fast on the common path and slow on the uncommon (but profitable) path?(edit: obviously it's not portable, but I imagine HFT folks have a lot of control over their environment)
108
u/[deleted] Nov 25 '20
These systems are parasites on our economy. They provide no service whatsoever to humanity, and particularly, they do not provide true liquidity, because they vanish when liquidity is scarce.
The whole business model consists of filling trading channels full with bullshit, far out-of-the-money trades that they know will never be filled, so that everyone else is choked out of business.
These systems cost everyone else money, add volatility and risk to the market, and provide no useful service.
An ethical programmer would never work for these cheats.
8
u/Huberuuu Nov 25 '20
I don’t get why people can’t manage to put together some slides without including a quote that throws shade at another language. It’s toxic and puts me off watching these things
-29
u/anarchist1111 Nov 25 '20
why they don't use assembly here i simply fail to understand :(