Skip to content

Releases: todbot/CircuitPython_Noise

Update library, optimze noise() function, add tests

Choose a tag to compare

@todbot todbot released this 01 Apr 22:08

Update, optimize noise(); add tests and timing example
noise.py:

  • Pre-compute F2, G2, and _G2x2m1 as float literals (removes math.sqrt on import)
  • Inline floor() via int() + fixup, removing two math.floor calls per invocation
  • Inline dot() via _gx/_gy tuples, removing 2-3 function calls and Grad attribute
    lookups per invocation
  • Cache 7 module globals as locals at function entry (MicroPython global lookup
    is a dict probe; locals are indexed directly)
  • Add https://github.com/Native decorator with ImportError fallback for CPython/CircuitPython
  • Net result: 0.297 → 0.266 ms/call on RP2040 @ 125 MHz (~10% faster)

tests/test_noise.py: add test suite covering output range, fidelity against the
original float reference implementation, 1D/2D equivalence, and determinism

examples/noise_timing.py: add example that times 1D and 2D noise() calls and
prints ms/call to the serial console

ruff.toml: ignore PLR0914 (too-many-locals, intentional in noise() and test
reference impl) and UP031 (percent formatting in examples)

Update release tag to fix circup semver issue

Choose a tag to compare

@todbot todbot released this 18 Sep 20:44
1da12f9
Merge pull request #1 from tekktrik/main

Fix GitHub Release CI

v1.0.1: Initial Release! (without typo)

Choose a tag to compare

@todbot todbot released this 07 Feb 01:33

Same as v1.0 but without README typo.

First release of simple simplex (Perlin-like) noise function for CircuitPython.

v1.0: First release!

Choose a tag to compare

@todbot todbot released this 07 Feb 00:26

First release of simple simplex (Perlin-like) noise function for CircuitPython.