pure-noise: High-performance composable noise generation (Perlin, Simplex, Cellular)

[ bsd3, library, math, noise, numeric ] [ Propose Tags ] [ Report a vulnerability ]

A high-performance noise generation library ported from FastNoiseLite. Provides N-dimensional noise functions (Perlin, OpenSimplex, SuperSimplex, Value, Cellular) that can be composed using Num or Fractional methods with minimal performance overhead. Noise values are generally clamped to [-1, 1]. Benefits significantly from LLVM backend compilation (~50-80% performance improvement).


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.2.0.0
Change log CHANGELOG.md
Dependencies base (>=4.16 && <5), primitive (>=0.8 && <0.10) [details]
License BSD-3-Clause
Copyright 2024 Jeremy Nuttall
Author Jeremy Nuttall
Maintainer jeremy@jeremy-nuttall.com
Category Math, Numeric, Noise
Home page https://github.com/jtnuttall/pure-noise#readme
Bug tracker https://github.com/jtnuttall/pure-noise/issues
Source repo head: git clone https://github.com/jtnuttall/pure-noise
Uploaded by jtnuttall at 2025-10-22T04:33:50Z
Distributions NixOS:0.1.0.1
Downloads 76 total (10 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for pure-noise-0.2.0.0

[back to package description]

pure-noise

Performant, modern noise generation for Haskell with a minimal dependency footprint.

The algorithms used in this library are ported from FastNoiseLite. The library structure has been retuned to fit better with Haskell semantics.

The public interface for this library is unlikely to change much, although the implementations (noiseBaseN functions and anything in Numeric.Noise.Internal) are subject to change and may change between minor versions.

Usage

The library exports newtypes for N-dimensional noise. Currently, these are just functions that accept a seed and a point in N-dimensional space. They can be arbitrarily unwrapped by with the noiseNAt family of functions. Since they abstract over the given seed and parameters, they can be composed with Num or Fractional methods at will with little-to-no performance cost.

Noise values are generally clamped to [-1, 1], although some noise functions may occasionally produce values slightly outside this range.

import Numeric.Noise qualified as Noise

myNoise2 :: (RealFrac a) => Seed -> a -> a -> a
myNoise2 =
  let fractalConfig = Noise.defaultFractalConfig
  in Noise.noise2At $
      Noise.fractal2 fractalConfig ((perlin2 + superSimplex2) / 2)

More examples can be found in bench and demo.

Performance notes

  • This library benefits considerably from compilation with the LLVM backend (-fllvm). Benchmarks suggest a ~50-80% difference depending on the kind of noise.

Benchmarks

Results

Measured by values / second generated by the noise functions. These results come from a benchmark with -fllvm enabled.

All results are for Floats.

There's inevitably some noise in the measurements because all of the results are forced into an unboxed vector.

2D

name values / second
value2 156_797_694
perlin2 138_048_921
superSimplex2 65_204_214
openSimplex2 64_483_692
valueCubic2 50_666_467
cellular2 20_819_883

3D

name values / second
value3 83_034_432
perlin3 60_233_650
valueCubic3 15_220_433

Examples

There's an interactive demo app in the demo directory.

OpenSimplex2

OpenSimplex2 OpenSimplex2 ridged

Perlin

Perlin fBm

Cellular

value distance2add