Benchmarked against Dyalog APL v20.0 and GNU APL v2.0
Benchmarked against Dyalog APL v20.0 and GNU APL v2.0
on Apple M5. Internal timing via ⎕AI (compute-only, no startup overhead). 40 iterations, 95% CI.
APL Run wins or ties 26 of 30 benchmarks vs Dyalog.
The AST viewer shows exactly which optimizations were applied to your code. Learn about execution badges →
| Benchmark | Expression | APL Run | Dyalog | GNU APL |
|---|---|---|---|---|
| Prime Sieve | ||||
| Primes N=2000 | (2=+⌿0=∘.\|⍨⍳2000)/⍳2000 | 1.8 ± 0.0 | 5.3 ± 0.9 | 65.6 ± 0.7 |
| Primes N=4000 | (2=+⌿0=∘.\|⍨⍳4000)/⍳4000 | 7.4 ± 0.0 | 18.1 ± 1.0 | — |
| Matrix Multiply | ||||
| MatMul 100×100 | M←100 100⍴⍳10000 ⋄ +/,M+.×M | 0.2 ± 0.0 | 0.5 ± 0.2 | 5.6 ± 0.6 |
| MatMul 200×200 | M←200 200⍴⍳40000 ⋄ +/,M+.×M | 0.9 ± 0.0 | 1.7 ± 0.3 | 39.1 ± 0.2 |
| MatMul 400×400 | M←400 400⍴⍳160000 ⋄ +/,M+.×M | 7.4 ± 0.0 | 9.3 ± 0.5 | — |
| Reductions & Arithmetic | ||||
| Sum ⍳2M | +/⍳2000000` (★ fused to O(1)) | 0.0 ± 0.0 | 0.6 ± 0.6 | 10.0 ± 1.4 |
| Sum ?2M⍴1000 | +/?2000000⍴1000` (materialized) | 8.7 ± 0.1 | 10.9 ± 0.5 | 32.5 ± 1.4 |
| Arith chain 10M | +/(3×⍳10000000)+(-⍳10000000) | 9.4 ± 0.1 | 11.2 ± 0.8 | 185.4 ± 3.2 |
| Recursive Dfns | ||||
| Collatz ⍳1K | +/c¨⍳1000` (recursive dfn) | 1.3 ± 0.0 | 38.4 ± 1.9 | — |
| Collatz ⍳5K | +/c¨⍳5000` (recursive dfn) | 8.5 ± 0.4 | 216.7 ± 2.6 | — |
| Fibonacci ⍳25 | +/f¨⍳25` (doubly-recursive dfn) | 7.1 ± 0.5 | 324.6 ± 4.1 | — |
| Sort & Newton | ||||
| Sort Int 100K | v[⍋v]` (100K random ints) | 1.3 ± 0.1 | 1.9 ± 0.3 | 24.6 ± 0.3 |
| Sort Float 1M | v[⍋v]` (1M random floats) | 16.0 ± 0.2 | 17.7 ± 1.3 | — |
| Sort String 100K | M[⍋M;]` (100K×10 char matrix) | 15.3 ± 1.6 | 18.4 ± 1.3 | — |
| Newton √100K | {⍵-((⍵*2)-N)÷2×⍵}⍣20⊢N | 2.4 ± 0.2 | 4.7 ± 0.7 | — |
| Newton √1M | {⍵-((⍵*2)-N)÷2×⍵}⍣20⊢N | 22.7 ± 0.5 | 23.9 ± 1.1 | — |
| LCS (Longest Common Substring) | ||||
| LCS N=80 | nested dfns, trains, ¨ | 3.4 ± 0.4 | 7.3 ± 1.2 | — |
| FFT (Cooley-Tukey) | ||||
| FFT 1024 | recursive dfn, complex ×/+ | 2.1 ± 0.1 | 3.8 ± 0.3 | — |
| FFT 4096 | recursive dfn, complex ×/+ | 8.0 ± 0.2 | 13.8 ± 0.8 | — |
| Standard Primitives | ||||
| Transpose 3K×3K | ⍉M` (3000×3000 matrix) | 17.2 ± 1.3 | 8.6 ± 1.2 | 67.3 ± 3.5 |
| Reverse 10M | ⌽v` (10M-element vector) | 5.8 ± 0.4 | 3.5 ± 0.9 | 66.0 ± 1.7 |
| Membership 2M∊1M | a∊b` (2M in 1M) | 3.9 ± 0.1 | 3.8 ± 0.5 | — |
| Rotate 10M | 100⌽v` (10M-element vector) | 4.5 ± 0.4 | 3.2 ± 0.8 | 67.7 ± 2.0 |
| Erdős Primes | ||||
| Erdős ⍳2500 | nested dfns, prime test, ¨ | 3.7 ± 0.0 | 6.8 ± 0.6 | — |
| Erdős ⍳5000 | nested dfns, prime test, ¨ | 8.0 ± 0.2 | 12.6 ± 0.7 | — |
| Lucky Numbers | ||||
| Lucky N=1600 | recursive sieve, replicate, modulus | 1.3 ± 0.4 | 0.8 ± 0.3 | — |
| Lucky N=3000 | recursive sieve, replicate, modulus | 1.8 ± 0.0 | 2.1 ± 0.4 | — |
| LSWRC (Unique Substrings) | ||||
| LSWRC N=117 | tacit defs, trains, compose, ¨ | 0.2 ± 0.0 | 0.4 ± 0.2 | — |
| LSWRC N=567 | tacit defs, trains, compose, ¨ | 2.5 ± 0.1 | 7.6 ± 0.8 | — |
| Shannon Entropy | ||||
| Shannon N=1500 | Key (⌸), compose bind, tacit trains | 3.6 ± 0.1 | 7.5 ± 0.5 | — |
| Benchmark | APL Run | Dyalog | GNU APL |
|---|---|---|---|
| Primes N=2000 | 1.0× | 2.9× | 35.6× |
| Primes N=4000 | 1.0× | 2.5× | — |
| MatMul 100×100 | 1.0× | 2.4× | 27.1× |
| MatMul 200×200 | 1.0× | 1.8× | 41.6× |
| MatMul 400×400 | 1.0× | 1.3× | — |
| Sum ⍳2M | 1.0× | 6.0× | 99.7× |
| Sum ?2M⍴1000 | 1.0× | 1.3× | 3.7× |
| Arith chain 10M | 1.0× | 1.2× | 19.8× |
| Collatz ⍳1K | 1.0× | 29.2× | — |
| Collatz ⍳5K | 1.0× | 25.5× | — |
| Fibonacci ⍳25 | 1.0× | 45.6× | — |
| Sort Int 100K | 1.0× | 1.5× | 18.6× |
| Sort Float 1M | 1.0× | 1.1× | — |
| Sort String 100K | 1.0× | 1.2× | — |
| Newton √100K | 1.0× | 2.0× | — |
| Newton √1M | 1.0× | 1.1× | — |
| LCS N=80 | 1.0× | 2.1× | — |
| FFT 1024 | 1.0× | 1.8× | — |
| FFT 4096 | 1.0× | 1.7× | — |
| Transpose 3K×3K | 2.0× | 1.0× | 7.8× |
| Reverse 10M | 1.7× | 1.0× | 18.9× |
| Membership 2M∊1M | 1.0× | 1.0× | — |
| Rotate 10M | 1.4× | 1.0× | 20.8× |
| Erdős ⍳2500 | 1.0× | 1.8× | — |
| Erdős ⍳5000 | 1.0× | 1.6× | — |
| Lucky N=1600 | 1.7× | 1.0× | — |
| Lucky N=3000 | 1.0× | 1.2× | — |
| LSWRC N=117 | 1.0× | 1.7× | — |
| LSWRC N=567 | 1.0× | 3.1× | — |
| Shannon N=1500 | 1.0× | 2.1× | — |
Last benchmarked: 2026-07-18. APL Run is single-core (no threading). SIMD enabled. Recursive dfn benchmarks (Collatz, Fibonacci) use Dyalog mode.
Sort uses ?N⍴N (integer data). Newton uses vectorized ⍣ iteration.
LCS uses nested dfns with trains, Each (¨), and Unique (∪). Lucky Numbers uses a recursive sieve with replicate and modulus.