Benchmark code evaluations for comparing Nock evaluation performance.
Benchmarks include:
.hoonsource files for the Nock code..nockfiles containing cells of[subject formula]..nounjamfiles of the Nock code.tests.jsonwith expected results for verification.
All benchmarks are self-contained; they do not call out to additional libraries or include dependencies on /sys/hoon. Each .hoon file inlines all required arms using the |^ core pattern (see ackermann.hoon as the gold standard).
-
Ackermann function,
ackermann -
Sieve of Eratosthenes,
sieve -
Naïve decrement,
dec -
Naïve addition (similar),
add -
Operations on direct atoms (
$x < 2^{31}$ ),atomcat -
Operations on indirect atoms (
$x > 2^{31}$ ),atomdog -
Operations on bignums (
$x > 2^{63}$ ),atomgmp -
Addressing,
bigslot -
Fibonacci sequence (recursive generating function),
fibonacci -
Factorial (tail-recursive),
factorial -
Matrix multiplication,
mmul -
SHA-512 hash,
sha512
- Fibonacci sequence (Binet's formula),
fibformula(requires FP core) - Mandelbrot set,
mandelbrot(easier with FP core) - MD5 hash,
md5
The norm/ directory contains a comprehensive test suite of Nock 4K opcodes (0–11 plus autocons). See norm/README.md and norm/REFERENCE.md for details.
Nock benchmarks supply the subject and the formula as a cell; no arguments are externally specified. In the Urbit Dojo, a benchmark may be run directly as:
=nok -build-file /=benchmark=/bar/ackermann/hoon
~> %bout .*(-.nok +.nok)
For cases for which a computation may run unreasonably long, the %jinx hint may be used to time-limit the computation: ~> %jinx.[~s100].
A benchmark report should include the following data:
- Hardware (CPU chipset):
cat /proc/cpuinfo, then reportmodel nameand number of cores (siblings) - Host OS:
hostnamectl, then reportOperating SystemandKernel. - Runtime version:
urbit --version, then report major version. (With Vere and Ares developer builds, report the commit hash or release candidate number, etc.) - Statistics: run a given calculation many times, and report
$n$ ,$\max(t)$ ,$\min(t)$ , and mean$\bar{t}$ . Include any critical details about the computation (such as range of input arguments).