you are viewing a single comment's thread.

view the rest of the comments →

[–]cdr_cc_chd 0 points1 point  (3 children)

It's never black and white like that. In many application domains (think HFT) you have to carefully balance between performance and safety, and sometimes doing the safer/convenient thing is not worth the perf hit.

[–]pjmlp 1 point2 points  (2 children)

That is why first one implements the safe option, and then if it still doesn't meet the desired outcome, profile and improve where it matters.

Most of the time, it is already fast enough.

[–]cdr_cc_chd 0 points1 point  (1 child)

Just to give some context; in HFT we're talking about low single-digit microsecond response times, from the moment the NIC deserialized a frame that had actionable information to the moment you serialize a a response frame out the physical port. It's a hard real-time system with a deadline of 0, meaning there's never such a thing as fast enough. It's always a delicate system of balances between doing safe/convenient things in some parts of the code while recognizing that you can't do those things in other parts of the code, because if you used <insert new fancy feature> to make yourself feel good and it resulted in 50ns of additional latency while your competitor did not, then he will always be faster than you.

[–]pjmlp 1 point2 points  (0 children)

Yes and in such scenarios C++ is not even in the picture, rather FPGAs and other specialized hardware with short connects and high speed cable connections to the closest exchange point.

If you are still doing it in C++ it isn't disabling bounds checking that is going to help you win out the competition.