N-body solar system
50,000 integration steps of the outer solar system (Sun + Jupiter, Saturn, Uranus, Neptune) using the canonical Computer Language Benchmarks Game initial conditions. Hot loop is struct-field access through a slice under FP load.
Compile time · median (cold)
Full statistics
| Runner | N | Compile | Runtime | P95 | Stddev | RSS | vs piko | Status |
|---|---|---|---|---|---|---|---|---|
| Native Gocompiled | 10 | 183 ms | 8.16 ms | 8.17 ms | 2.76 µs | 68 MiB | 85.9× | OK |
| Piko interpbytecode VM | 10 | 2.13 ms | 533 ms | 541 ms | 3.38 ms | 105 MiB | 1.00× | OK |
| CPython 3.13bytecode VM | 10 | 508 µs | 393 ms | 405 ms | 6.13 ms | n/a | 0.24× | OK |
| PyPy 7.3tracing JIT | 10 | 423 µs | 27.1 ms | 28.9 ms | 550 µs | n/a | 0.20× | OK |
| tengobytecode VM | 10 | 414 µs | 1.14 s | 1.18 s | 32.6 ms | 2.18 GiB | 0.19× | OK |
| scriggobytecode VM | 10 | 771 µs | 960 ms | 989 ms | 18.9 ms | 687 MiB | 0.36× | OK |
| mvmbytecode VM | 10 | 744 µs | 1.15 s | 1.19 s | 24.0 ms | 66 MiB | 0.35× | OK |
| yaegiAST walker | 10 | 792 µs | 1.55 s | 1.70 s | 90.2 ms | 66 MiB | 0.37× | OK |
Workload & symmetry rules
Workload
Gravitational simulation of five bodies (Sun, Jupiter, Saturn, Uranus, Neptune) over 50,000 time steps. Each step computes pair-wise gravitational impulses for every (i, j) pair, then integrates positions from velocities. Output is the conserved energy before and after, each multiplied by 1e9 and rounded to integer.
Symmetry rules
- Bodies are stored as a slice of records with named fields (
Bodystruct on Go, class with__slots__on Python). The hot loop pays struct-field-access cost on every runner. - Tengo has no struct type, so its translation uses parallel arrays (struct-of-arrays) over the seven body fields. Shape of the hot loop is otherwise identical.
math.Sqrt/math.sqrtis the only stdlib intrinsic allowed; sqrt is implemented identically (libm) across every runner so its cost does not distort the comparison.
Banned
- Numpy, scipy, gonum, hand-written assembly, any SIMD shortcut.
- Threading or process parallelism. This benchmark is single-threaded serial throughput by design (bench 16 covers parallelism).
Why this benchmark exists
The unique signal: struct field access inside an FP hot loop. Bench 14 uses four local scalar floats and no struct. Bench 21 uses 2D float arrays. Neither stresses the struct path. piko's struct-in-typed-slice path is the open Phase 7 (struct unboxing) area; this benchmark gives a clean before-after measurement of any work on that path.
Source code
piko / Go
piko_source.gonative Go
native_main.goCPython / PyPy
cpython.pytengo
script.tengo