Live data from Hacker News

Which programming language or compiler is faster

programming-language-benchmarks.vercel.app

21–30 of 90 posts

Re: Which programming language or compiler is faster

#21

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

That the same logical steps expressed in one language results in less computation time spent - when compiled or interpreted - than when expressed in another language. Seems a resaonable question to ask, given there's more to a language than how you express things. Like toolchain, library availability and community.

Re: Which programming language or compiler is faster

#22

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

I was curious too and found this:

https://stackoverflow.com/questions/2513741/c-vs-c-for-perfo...

from which I gather that if you're using an allocator function that zero's out memory then it will be slower of course.

Re: Which programming language or compiler is faster

#23

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.

Re: Which programming language or compiler is faster

#25

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. However, most mainstream programming languages are very similar to each other.

Re: Which programming language or compiler is faster

#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 compiled once.

With the new module feature of C++20, compilation is transformed into a DAG, and it is still unclear if it's really faster than just throwing a lot of cores at the problem.

Re: Which programming language or compiler is faster

#27

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.

There's a big effort to make that happen though, with Julia interop https://github.com/JuliaInterop

Re: Which programming language or compiler is faster

#28
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.

I believe this is measuring how fast the binary produced by different compilers is, rather than how long the compilation takes.

Re: Which programming language or compiler is faster

#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 it compiles all the library dependencies and specializes them to the given data types.

Re: Which programming language or compiler is faster

#30

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?

In addition to the other replies, the comparatively long startup time makes it unsuitable for short scripts, and with a few dependencies it becomes unsuitable for even medium length programs. The startup time is always coming down and there are ways to compile dependencies ahead of time though. The JIT compilation can be annoying for real-time applications too.
Post reply on HN