News for hackers. Stuff that matters.
Re:What Should I Know About Garbage Collection as a Java Dev... by jandrewrogers on Tuesday January 10, 2023 @11:45PM (#34335091)
> As I always say, C usually tops the chart when it come to language performance.

This has not been true for a long time. Modern C++ consistently outperforms C in practice, mostly due to its extensive metaprogramming facilities.

Re:What Should I Know About Garbage Collection as a Java Dev... by GuB-42 on Wednesday January 11, 2023 @04:01AM (#34336539)
C++ has more potential (indeed thanks to metaprogramming), but the average idiomatic C program is often faster. C++ tends to do a lot of implicit allocation, or initialize values even if not necessary. Also, smart pointers are not free (at least shared_ptr and weak_ptr are not).

If you have a good understanding of how C++ works, eschew convenient but costly C++ features, and care to optimize. You may get better performance than C. I guess that's part of the reason why most game engines are made in C++.

Important to note though that you will only get fast if you turn on compiler optimization, which actually is a problem as debug builds may end up unusably slow.