4 ms·
No I'm not, those new-fangled compilers with that fancy ass "think about performance up front" language doesn't have the umpteen years and billions of dollars w
by mreiland 12y ago
No I'm not, those new-fangled compilers with that fancy ass "think about performance up front" language doesn't have the umpteen years and billions of dollars worth of research put into it the way C++ has.
- derefr 12y agoIf you want all the advantages of C++ compilers, you can write a backend for the language's compiler that generates C++. If the language is actually performance-focused, there shouldn't be any semantic mismatch in doing so; for example, every Rust type should be able to be translated 1:1 to a (much more syntax-laden) C++ type. The new-generation languages (of which Go is a bad example; Rust and Nimrod, and now Swift, are much better ones) don't attempt to get the computer to do the kind of magic at runtime (garbage collection, type reflection) that made previous-gen languages so slow. Instead, these NGLs start with the assumption of C/C++ runtime semantics, and then, through extra work done at compile time (e.g. type inference, ownership-tracking) clear away as much implied/redundant/unneeded syntax as possible.
- mreiland 12y ago> If you want all the advantages of C++ compilers, you can write a backend for the language's compiler that generates C++. Well it sounds as if it's as simple as being able to take advantage of optimizations to meet or beat C++. good luck with that. Also, FYI: Nimrod is garbage collected, which goes counter against your reasoning.
- didroe 12y agoIt's much simpler than that. It actually makes writing a compiler easier as you have higher level abstractions to work compared to generating machine code. There are many languages that compile to C which should prove to you that it can be done. I don't see why targeting C++ would be any different and I'm sure there are languages already out there that do.
- Someone 12y agoYou can compile any language down to C or C++, but that doesn't mean that it will run as fast as well-optimized C/C++. The moment you include dynamic dispatch, auto-conversion to big integers, or one of a zillion of other high-level features without also introducing ways for the programmer to indicate how the compiler should implement them, you give up being just as fast as C/C++. Yes, the difference may be small, and spending time on improving your compiler can make it smaller and smaller, but for any 'real world program', it won't be zero. The same is true for C vs assembly, but there, the difference mostly _is_ small because C has none of those high-level features. Also, few people have the skills and the time to wrote well-optimized C/C++.
- mreiland 12y agobam, nailed that shit, especially the point about performance costs inherent in a feature set rather than in a language. I just didn't want to continue a conversation with someone who thinks adjusting the age old "optimizations will eventually make it as fast" to be "compiling to C/C++ as an optimization will eventually make it as fast" was somehow going to magically make it come true. It's the same old argument reskinned, and as you pointed out, the feature set has a lot to do with it.
- derefr 12y agoI said nothing about "compiling to C/C++ as an optimization." I said targeting C++'s semantics (i.e. having only features C++ already has) makes a language fast.
- mreiland 12y agohttps://news.ycombinator.com/item?id=7921511 https://news.ycombinator.com/item?id=7921511 > If you want all the advantages of C++ compilers, you can write a backend for the language's compiler that generates C++.
- deleted 12y ago[deleted]
- cdi 12y agoinvestment in C++ compiler technology has been shared in form of llvm with rust and other languages.
- mreiland 12y agoLLVM is not a C++ compiler, CLANG is a C++ compiler frontend that uses LLVM as it's backend. Significant difference there.