Hacker News new | ask | show | jobs
by PaulDavisThe1st 1854 days ago
One reason could be that C++ tends to be used more in performance-critical contexts, and frequently the abstractions present in "every other language" can get in the way of performance.
1 comments

also the memory management model in c++ is much more complex - most other languages just use garbage collection to deal with reference lifetimes
garbage collection is one of the abstractions that can interfere with performance. it's out of the question for real time contexts, for example.
The first link covers cases most simply described as "it needs to be fast, as fast as possible, but things won't go wrong if there's a random 8msec delay".

Then there's "things will go wrong if there's a random 8msec delay".

Then there's "people will die and/or property will be destroyed if there's a random 8msec delay".

I was referring only to the last two. And yes, that means no malloc.

Depends how relevant 8msec are on a battleship weapon guidance system,

https://www.ptc.com/en/blogs/plm/ptc-perc-virtual-machine-te...

On any case, that is the reason why I started with depends, just like everyone wants to do big data that fits into a USB floppy, there are those cases where CircuitPython would be more than enough, yet people insist in using Assembly.

In some cases only Ada/SPARK or MISRA will do, others not, yet all of them might fall under real time and embedded deployment.

No, it doesn't depend. That fits clearly into the first category, in which things do not go wrong when there's an 8msec delay.

By contrast, using a DAW with typical settings, an 8 msec delay is catastrophic within the scope of the task, even though nobody gets hurt and nothing gets destroyed.

The first one targets “sub-millisecond”, which is a eternity in current systems.

According to the third link:

> we observed a negative correlation between MISRA rule violations and observed faults

So, MISRA isn’t really helping with real time at all.

The second link claims pauses are capped at 10us, which (if true) is actually competing with careful use of malloc.

Hence why I stated "Depends".

It is real time enough to drive battleship weapon systems, the kind of apps where the wrong people die when a GC goes wrong.

https://www.ptc.com/en/blogs/plm/ptc-perc-virtual-machine-te...