Hacker News new | ask | show | jobs
by Devid2014 3406 days ago
https://github.com/marblestation/benchmark-leapfrog

This are not valid benchmarks at all. What is the point to run N-Body sim with all particles set to 0.0 ?

Where is the result of the sim ?

Why it will be not validated at all ?

To make this look like real benchmark one will need to use the same start condition and then validate that result for all languages is the same.

It would be great to have C++ code using Eigen library for example ? To show the difference .

Also this is naive O(N^2) sim that could be speed up using Fast multipole method (FMM), but of course this would be much more complicated to do this in Rust or Go as in C++.

4 comments

As others have pointed out, adding insult to injury, in the Rust version the bulk of the actual calculation is optimized out completely! Adding a print at the end increases the runtime by an order of magnitude.

The Rust community is actively hurt by people doing things like this, no-one takes this type of work seriously.

Edit: please come back when you've replicated and validated at least something like a basic, well-understood finite difference solver of single-phase incompressible Navier-Stokes, and shown that it's either equivalently fast and much easier code, or significantly faster (very unlikely). Do note that a readable Fortran version is going to be ~400 lines, so there's not a terribly large room for improvement. Also, we already have a good language that gives us slower and much easier code, namely Python.

I wouldn't bet that FMM is more complicated to implement in Rust as in C++.
For me Rust has a lot of potential to write more secure code in places where it is needed but astrophysics is may be not one of them.

Not sure about language it self, my knowledge about Rust is limited. But st is at least harder because we already have optimized libraries that can do this in C++.

Do some one know such library for Rust ? It would be great too look at it.

Indeed, the code that was initially published apparently didn't even output any results, and that can be optimized to "do nothing, return"?
The code has now been improved with all the suggestion friendly made by the Hacker news and Rust subreddit communities. Thanks!
I just had a look at the Fortran code, and oh boy, it's not pretty, and far from "canonical" Fortran. I will submit a PR (hopefully later tonight) that makes it less ugly and slow.

(Protip: don't use if's inside tight loops. Just don't.)

Update: just sent you a PR that reduces the amount of code by ~70% while increasing the speed by ~30% for the Fortran version.
Merged! Thank you very much :-)