PeaBox Lab › PeaLang › Learn › Chapter 34 › Lesson 2

Part V — The Modern Experience Layer · Chapter 34 · Lesson 2 of 2

A numerics fast path you can actually use

The JIT chapter showed the mechanism; this lesson is judgment: when to reach for it, and what to do instead when it doesn't apply.

What actually gets faster

What does not

The bigger lever for analytics: Arrow and DuckDB (v1.6.0)

let backend = analysis.preferred_backend()   # PythonBackend or DuckDBBackend
let plan = analysis.create_query_plan("""
  SELECT city, SUM(amount) AS revenue
  FROM orders
  WHERE status = 'paid'
  GROUP BY city
""")
print plan

For genuinely large analytics, the Arrow/DuckDB path dominates anything the JIT gives a scalar interpreter: predicate/projection pushdown, vectorized execution, out-of-core frames, parallel aggregation. The JIT optimizes your per-row code; the Arrow backend optimizes your data movement. Use both, and know which lever you are pulling when a query is slow.

Measurement discipline

let report = analysis.benchmark_compare([before_run, after_run])
print report.speedup

Three rules that separate real optimization from vibes. First, benchmark on your workload — yours, with your data sizes, your access patterns. Second, archive baselines so regressions surface as deltas, not as vague slowness complaints three weeks later. Third, report medians with spread, never best-of-N; best-of-N is how bad changes get merged.

Version note

Version note. In v2.0.0, optimize_instructions was effectively hints you could ignore. In v2.2.0 it is a real pass pipeline, wired into the analysis, stats and numerics namespaces, and applied automatically on supported paths. If your v0.63-era code called loop_unroll_hint for its side effects, those calls now fold into the pipeline.

Where this leaves the 1.0-era performance story

Guided practice

← Previous Next →