6 ms·
> In which world is it okay to compile a trivial 5-line example three times slower than a full database engine Well, as explained in the article, those 5 lines
by 21 8y ago
> In which world is it okay to compile a trivial 5-line example three times slower than a full database engine
Well, as explained in the article, those 5 lines generate hundred thousands of lines of code behind the scene.
And you don't use C++ for fun, you use it because you have a serious performance problem. And in that case you'll wait the compile times, because there is no alternative.
Let's not even go into link time code generation or profile guided optimizations, which increase compilation times by another order of magnitude.
- zozbot123 8y ago> those 5 lines generate hundred thousands of lines of code behind the scene. That's part of the problem; most of the time, the "thousands of lines of code" that are created from type-generic code have a lot of useless duplication, and the compiler has trouble coalescing the duplicated and redundant code (I don't even think a serious attempt is made, AIUI). There's a lot of scope for improvement.
- modeless 8y agoIf you really have a serious performance problem, the answer these days is more likely to be a GPU, DSP, FPGA, or even an ASIC. The era of C++ on CPUs being the right solution for most high performance computation problems is coming to a close now that Moore's Law is ending.
- aldanor 8y agoThis shouldn't have been downvoted.
- muro 8y agoIf you deploy the code on a large number of machines, especially out of your control, most of those don't apply. There is a large scale of problems that require/benefit from optimised non-GPU code: - OS and related tools - applications (e.g. image processing, spreadsheets, engineering applications) - browsers - games - compilers - low level libraries - databases Yyou are probably using many of those and would not enjoy them being slower.
- Gibbon1 8y agoI totally disagree, I think that era has been over for the last 20 years. I keep coming back to a talk by Daniel J. Bernstein, that the assumptions computer science teaches about performance are wrong. His claim is for real programs most code is ice cold and a tiny percentage is hot. And that's getting worse not better as time goes on. What important is; correctness, latency, compile time. Not raw speed.
- adrianN 8y agoIn my experience that claim is very true before you fire up your profiler. But once you've optimized your program for a bit the profile gets a lot flatter.
- Gibbon1 8y agoI think if your programs profile is flat it means none of your code is actually in the hot path. It's buried behind library functions and OS calls.
- deleted 8y ago[deleted]
- pjmlp 8y agoEven though I do like C++, I kind of agree. As Wirth languages fanboy, I belive that if Java 1.0 had AOT compilation from day one, instead of leaving it to commercial third parties, and proper value types, the amount of C and C++'s adoption would have looked much different.
- Koshkin 8y agoI wonder what Wirth would have to say about Java...
- pjmlp 8y agoAs you might imagine, not kind words. "Modern languages like Java and C# may well be superior to old ones like Fortran, PL/I, and C, but they are far from perfect, and they could be much better. Their manuals of several hundred pages are an unmistakable symptom of their inadequacy. Engineers in industry, however, are rarely free from constraints. They supposedly they must be compatible with the rest of the world, and to deviate from established standards might be fatal." https://www.inf.ethz.ch/personal/wirth/Miscellaneous/IEEE-Annals.pdf https://www.inf.ethz.ch/personal/wirth/Miscellaneous/IEEE-An... "In 1995 Sun Microsystems presented its language Java , fully 6 years after Oberon. It incorporated much of the "philosophy" of Oberon, but, alas, chose the style and syntax of C. Around 2000 Microsoft released its language C# as a strong competitor of Java, and Google followed in 2007 with its language Go, even more strongly following (the 18 years old) Oberon. The crux with these languages, which all became wide-spread due to strong industrial support, is their size and complexity. The ambition to provide everything to everybody prevailed and let them grow into complex bodies difficult to master." https://www.inf.ethz.ch/personal/wirth/Miscellaneous/ComputersAndComputing.pdf https://www.inf.ethz.ch/personal/wirth/Miscellaneous/Compute...
- makapuf 8y agoUsing complexity as an argument against Go is not really accurate in my point of view.
- adrianN 8y agoThere is an alternative: writing simple C++ instead of Modern C++, or even using plain C.
- gok 8y agoBy simple you mean without the STL?
- Koshkin 8y agoThen you increase the time you need to spend writing your program. You will also most likely end up cutting some corners, and the result will be of questionable quality in one way or another.
- thezilch 8y agoHolding in my brain and using all these "modern" features increases the time I need to think about code, data, and algorithms, and that's usually where most coding spends my time -- thinking. And "modern" compile times... increasing the time between results and further thinking and writing. Don't forget that; the article doesn't. And "modern" debugging... well, good luck.
- Koshkin 8y agoWell, people have been known to hold in their brains information pertinent to their trade. Professional training helps, too. I can only guess the extent of what a mathematician, a physicist or a medical doctor must remember to be successful in what they do.