Live data from Hacker News

Which programming language or compiler is faster

programming-language-benchmarks.vercel.app

31–40 of 90 posts

Re: Which programming language or compiler is faster

#32
post #29

Julia 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…

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

#33

Julia 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.

Java doesn't integrate well with Julia, but Julia's interop with C++ and python are both pretty painless. pycall in particular is about as easy as you could imagine.

Re: Which programming language or compiler is faster

#34
post #26
post #7

This 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…

You show me that IDE for C++ who is using those multicore CPU's for compilation who's faster than Delphi, for same number of lines and/or external dependencies. Btw, Delphi is still using 32 bits for its IDE and a single core and still blows out of the water anything else in terms of millions of lines of code compilation time.

Re: Which programming language or compiler is faster

#35

What does it even mean for a language to be faster?

Same idea as comparing different compilers for the same language. Some algorithms can be expressed in some languages in an essentially identical way. For example, various sorting algorithms look pretty much the same in Fortran, Pascal and C. Only surface syntax differs. Assuming this is done fairly with each implementation being properly equivalent, it's a way to compare the speed of the languages, at least for that algorithm.

Re: Which programming language or compiler is faster

#36

The 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…

>If you're an expert at Pascal, good luck trying to use it on the Arduino.

It is supposed to work with FreePascal: https://wiki.freepascal.org/AVR_Programming

Re: Which programming language or compiler is faster

#37

Can anyone explain why C++ beats out C so clearly?

C++ is just a stricter C - if you write proper C, it will be a correct C++ program, therefore it would run at the same speed. There's no way C can be other than marginally faster than C++ - if you write C and compile it with a C++ compiler.

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

#38
post #29

Earlier 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).

So the compile times gotten better, but still are quite slow in comparison?

Re: Which programming language or compiler is faster

#39

Can anyone explain why C++ beats out C so clearly?

There is no reason, the fasted C++ code is actually C - I really don't know why somebody wrote that as C++.

https://github.com/hanabi1224/Programming-Language-Benchmark...

https://github.com/hanabi1224/Programming-Language-Benchmark...

Post reply on HN