4 ms·
This is why C++ should be put to pasture and replaced by properly managed languages. It's time.
by Yuioup 6y ago
This is why C++ should be put to pasture and replaced by properly managed languages. It's time.
- cgrealy 6y agoSure, all we need to do is rewrite billions of lines of code in some of the most popular software on the planet. And then replace it with... a language that is exactly as performant, is available on every known platform and has replacements for all the existing libraries (including all the ones written in C!).
- titzer 6y agoI'll pay 15% performance for safety[1]. It's just that we have the wrong priorities, and you betrayed that default attitude again with the requirement that everything be "exactly as fast" as before. I still do not understand this focus on performance above everything else. It is absolutely unquestioned. We can't even talk about it. And it's constantly an argument that is undone by time. Machines are still getting faster. In the heydays of Moore's law, when performance was doubling literally every 12 months, if we were arguing about 15% of CPU performance, that's 2--TWO--months of performance. Now, it might be 1-2 years to get 15% single-core performance. But almost no one is limited by single-core performance anymore. We got stuck with the worst of all possible worlds--long compile times, long debugging times, long bugtails, horrible security, rickety and hard to refactor, ugly code. Oh, but it's fast. Fast and broken. Wonderful. Wonderful. Grandma is so much happier with her 15% faster something or other that spends 95% of its time idle waiting for user input. Oh, but that 15% of 5%...man that 0.8% is keeping me up at night! We forgot to zoom out to see that people need and depend on reliable software and utterly failed at that. It's as if we removed seatbelts, airbags, windshields, and mounted knives in random places in cars because we thought everyone wanted to go fast. No other disciple in all of engineering is so wrong with their priorities. God, society should be hopping mad at us for being so hostile to them. [1] Obviously, performance differences between "fast" languages and "safe" languages are so variable that we might as well be talking about comparing Fords to Ferraris--without specifying whether we are talking racecars (Ford makes some fast ones)! But 15% is a number we see often in the JVM world. After years in this field, I think the fastest safe language is not more than 15% off the fastest unsafe language, across the wide spectrum. Sometimes, you can get absolutely the same performance for the innermost hot loop out of a safe language vs unsafe language in some situations, you can get 2x slower. But people get terrified they'll never figure out why, that there is some kind of hidden, unknowable "language cost" they'll never get offer. Which is of course hogwash. Every program can be tuned and improved. Offer tools to find and remove bottlenecks and stop being sloppy with allocating memory.
- acdha 6y agoThere’s one other big question I’d ask: how much performance has been left on the floor because people are afraid to substantially refactor old C/C++ code or, especially, make it concurrent? I would bet that the algorithmic and parallelism improvements would in many cases be far more impactful, especially on user-visible latency, than what’s hypothetically lost by switching to a safe language with modern features.
- cgrealy 6y agoI think you missed the main point, which was the "billions of lines of code" part. It's not a question of simply retiring C++.. it has to be replaced with something. Even safe languages frequently rely on libraries implemented in C or C++ as part of their runtime. Even if you were willing to pay a 100% performance penalty (and there are plenty of places where I'd be fine with that), it's still a massive undertaking.
- titzer 6y agoAnd usage of C++ is still growing exponentially, so the number of lines of code is growing faster than our ability to rewrite/replace them. I know, it's a losing battle. We'll never do it. We are stuck with C++ until the end of time because of the sunk cost fallacy. If everyone who currently works on C++ instead switching to rewriting instead of adding, we'd be able to replace everything in 5 years. If C++ is only kept around because of a few libraries needed to implement the runtime of safe languages, then I would consider that some kind of victory.