▲ | chubot 4 days ago | ||||||||||||||||||||||||||||||||||||||||
I was also there in the 2000's and I remember people saying Java can be just as fast as C And in particular that garbage collection can be faster than malloc/free. This is technically true in the case you have a naive C program. There are tons of C programs out there, and some are slow. (But there are more slow Java programs out there) But it's 100% clear now that GC has a significant cost, and while you can optimize a bad C program, it can be very hard in many cases to optimize the cost of GC away. C offers more freedom and thus more footguns, but the freedom also means you don't really have a performance cap. And I prefer GC -- most programs I write will have GC; I just recognize the performance cap, and design accordingly. (In fact I wrote a GC for a subset of C++ for https://oils.pub -- I actually think this is a language with nicer performance properties than Java, mainy due to being AOT) | |||||||||||||||||||||||||||||||||||||||||
▲ | gf000 4 days ago | parent [-] | ||||||||||||||||||||||||||||||||||||||||
If you bring parallel processing into the picture (shared memory model), then the achievable performance caps per dev work change significantly though. I will very easily write a faster parallelizable program in Java, before I get the C one even remotely correct and then we haven't even taken into account every future maintenance cost. Also, the way C devs often hide the cost is simply.. less efficient code like copying stuff right and left, etc, which can actually be more "bravely" avoided in managed languages. | |||||||||||||||||||||||||||||||||||||||||
|