══════════════════════════════════════════════════════════════════ COMPUTE-INTENSIVE BENCHMARK: Native J vs Futhark ══════════════════════════════════════════════════════════════════ Backend: multicore Threads: 12 ┌─────────────────────────────────────────────────────────────┐ │ TEST 1: Logistic Map (1000 iterations per element) │ │ │ │ x[n+1] = r * x[n] * (1 - x[n]) where r = 3.99 │ │ │ │ Operations per element: ~3000 FLOPs (3 ops × 1000 iters) │ └─────────────────────────────────────────────────────────────┘ Size J (ms) Futhark (ms) Speedup Match -------- -------- ------------ --------- ----- 1000 2.2 1.3 1.7x OK 10000 27.1 8.2 3.3x OK 100000 203.2 55.5 3.7x OK 500000 1764.8 293.1 6.0x OK 1000000 6540.8 591.7 11.1x OK Maximum speedup: 11.1x ┌─────────────────────────────────────────────────────────────┐ │ TEST 2: Complex Math (100 iterations of trig/exp/log) │ │ │ │ x = sin(cos(exp(log(1+x)))) repeated 100 times │ │ │ │ Operations per element: ~400 transcendental ops │ └─────────────────────────────────────────────────────────────┘ Size J (ms) Futhark (ms) Speedup Match -------- -------- ------------ --------- ----- 10000 13.7 22.8 0.6x OK 100000 466.4 151.6 3.1x OK 500000 2624.3 810.7 3.2x OK 1000000 4958.5 1538.2 3.2x OK 2000000 9919.4 3074.5 3.2x OK Maximum speedup: 3.2x ┌─────────────────────────────────────────────────────────────┐ │ TEST 3: Mandelbrot Escape Count (up to 1000 iterations) │ │ │ │ Count iterations until |z| > 2 where z = z² + c │ │ Using real arithmetic: x,y coordinates on complex plane │ │ │ │ Variable work per element: 1 to 1000 iterations │ └─────────────────────────────────────────────────────────────┘ Size J (ms) Futhark (ms) Speedup Match -------- -------- ------------ --------- ----- 1000 240.0 1.0 229.0x OK 10000 1948.3 2.0 952.8x OK 50000 12090.5 8.6 1402.8x OK 100000 25025.2 17.4 1441.5x OK 200000 46474.5 40.9 1135.7x OK Maximum speedup: 1441.5x ══════════════════════════════════════════════════════════════════ SUMMARY ══════════════════════════════════════════════════════════════════ Test Max Speedup ───────────────────────────────────────── Logistic Map (1000 iters) 11.1x Complex Math (100 iters) 3.2x Mandelbrot Escape 1441.5x Key insight: Futhark excels when each element requires many independent calculations (high compute-to-memory ratio). These speedups come from: - Parallel execution across 12 CPU cores - Loop fusion (no intermediate arrays) - Optimized code generation ══════════════════════════════════════════════════════════════════