Can anyone explain why C++ beats out C so clearly?
Which programming language or compiler is faster
31–40 of 90 posts
Re: Which programming language or compiler is faster
#32Julia always seems to rank #1 or close to it when compared to other interpreted languages but I only ever see it used for research and math. Why doesn’t anyone use it for anything else?
Julia is incredibly slow to compile. Far worse than C++ last time I tried. For interactive notebooks, I found it’s common to have a single line take a couple minutes to compile - it’s simply not interactive in the way Python is, despite having good runtime performance once compiled. The deal breaker for me is that its compiler is JIT based whether you want it or not. Code will hang at runtime for multiple minutes as…
Re: Which programming language or compiler is faster
#33Julia always seems to rank #1 or close to it when compared to other interpreted languages but I only ever see it used for research and math. Why doesn’t anyone use it for anything else?
Lack of integration with other massive libraries that Python, Java and C++ have. Lack of books, tutorials and extensive knowledge bases that Python, Java and C++ have.
Re: Which programming language or compiler is faster
#34This is a really strange benchmark to use. Compiler speed is not an issue for these 100ish line standalone benchmarks. The question is how fast it is for a million-line project or worse. I doubt c or c++ do good there with their header file includes for dependencies.
On a single core processor, obviously not, but massive C++ codebase are compiled with multicore CPU, and often distributed. The advantage of the header inclusion model is you get an bunch of independent compilation units, and so it's straight forward to parallelize. A common way to speed things up even more is to merge some cpp file together, so each compiler thread is active for longer and common headers are compile…
Re: Which programming language or compiler is faster
#35What does it even mean for a language to be faster?
Re: Which programming language or compiler is faster
#36The faster programming language or compiler is the one you use. Always.
No matter how good you are at Python, if you need to build an SPA, it'll be far faster to go with Javascript. This is true even if you have to learn Javascript from scratch. If you're an expert at Pascal, good luck trying to use it on the Arduino. The hardest part of learning a second and third programming language is overcoming your own frustration. Yes there are some pretty gnarly concepts in languages like Haskell…
It is supposed to work with FreePascal: https://wiki.freepascal.org/AVR_Programming
Re: Which programming language or compiler is faster
#37Can anyone explain why C++ beats out C so clearly?
Then you have various optimizations that come from things like templates, constexpr. Look at the qsort method - to have a modicum of genericity you need to pass a function that will be invoked. Instead, a C++ version would be able to be optimized to compare the elements directly, without calling a function, avoiding a big number of function calls.
There's no way to make C faster than well written C++. But C++ is complex and a lot of people write bad C++, that's why it has developed a bad reputation. It's really undeserved.
Re: Which programming language or compiler is faster
#38Earlier quoted context omitted.
Julia is incredibly slow to compile. Far worse than C++ last time I tried. For interactive notebooks, I found it’s common to have a single line take a couple minutes to compile - it’s simply not interactive in the way Python is, despite having good runtime performance once compiled. The deal breaker for me is that its compiler is JIT based whether you want it or not. Code will hang at runtime for multiple minutes as…
Do you have an example for minutes of compile time for a single line? Especially since 1.6 (march 2021), I haven't run into that (and I'm using Julia pretty much full-time).
Re: Which programming language or compiler is faster
#39Can anyone explain why C++ beats out C so clearly?
https://github.com/hanabi1224/Programming-Language-Benchmark...
https://github.com/hanabi1224/Programming-Language-Benchmark...