Live data from Hacker News

Benchmarking 20 programming languages on N-queens and matrix multiplication

github.com

101–110 of 194 posts

Re: Benchmarking 20 programming languages on N-queens and matrix multiplication

#102
post #94
post #72

Earlier quoted context omitted.

In some cases there are other reasons for hoiting the dereference too. For example, Crystal will check if the array access is out of bounds and by hoisting variables that will be done a lot less seldom, which can have huge effects for code that does a lot of that, like matmul.

Doesn’t that get mostly optimised away by the cpu branch prediction?

The branch does, but you still have the comparison itself, and also the branch instruction to decide and skip (although thanks to branch prediction, your pipeline doesn’t get flushed).

If you have enough idle execution units, you might not see a difference in wall clock time. But with many algorithms you can put those units to good use.

Re: Benchmarking 20 programming languages on N-queens and matrix multiplication

#103
post #5

What is this supposed to demonstrate? There appears to be roughly the same code structure, ported to every language, while for some languages, arbitrary optimizations are introduced (such as using `array` instead of `list` in Python). But nobody working in Python uses matrix multiplication code written in Python. They use NumPy, which is a de facto standard library for people working in the relevant fields. It's as m…

> What is this supposed to demonstrate?

It is supposed to show the performance of a language when you have to implement a new algorithm in the language. This may happen if you can't find the algorithm in existing libraries. If you don't like matmul, ignore it and focus on nqueen, sudoku and bedcov.

Re: Benchmarking 20 programming languages on N-queens and matrix multiplication

#104
I think this shows the value of programmer productivity over performance at all costs. Python is one of the most popular languages despite having performance issues for complex algorithms. Users value clarity and ease of expression over performance. That's why Python is primarily used a glue code in these complex tasks.

Re: Benchmarking 20 programming languages on N-queens and matrix multiplication

#109
post #29

N-queens and matrix benchmark without Fortran and Wolfram Mathematica?

I was just popping in to make a similar comment. Fortran is probably doing the heavy lifting for most of the entries here, you might as well show how much your language-specific overhead is by including it.

Re: Benchmarking 20 programming languages on N-queens and matrix multiplication

#110
post #106

Why is c# so slow for Matmul compared to java?

The implementation isn’t using any modern C# features?

Unfortunately it doesn't. The newest and hottest way to do this is to either use bespoke matmul from System.Numerics.Tensors or at least using Vector for SIMD (which is trivial and not "the last mile" optimization it often seems to be).
Post reply on HN