bjz/noise-rs — pull request #36 by Cifram (2014-12-31 11:07:50+00:00)
Title: Simplectic noise, 3D OpenSimplex noise, and benchmarks

The 3D OpenSimplex implementation is rough, pretty much a direct port of the Java reference implementation with no extra concessions to idiomatic Rust beyond what was necessary to make it compile. None the less, it works. It's so ponderously complicated that the effort required to clean it up and make it properly rustic is really off-putting.

So I thought long and hard on the problem, and invented a new thing called Simplectic noise. It uses the same kind of tesselation as OpenSimplex, but calculates it very different. The code is much simpler, more compact, and more comprehensible, and it turns out to be also be much faster. The quality of the results is pretty comparable.

In order to determine the relative speed of these noise functions, I also added some benchmarks.

Note that the 3D simplectic noise can be more than twice as fast as it is right now. If you remove the 4D simplectec noise, you'll see the 3D noise get much faster. The compiler optimizations are doing something weird here, and I'm not sure how to fix it. But even with this handicap, it's still faster than 3D OpenSimplex.