Skip to content

Feature/scalar optimization#1

Open
vade wants to merge 1 commit into
mainfrom
feature/scalar-optimization
Open

Feature/scalar optimization#1
vade wants to merge 1 commit into
mainfrom
feature/scalar-optimization

Conversation

@vade

@vade vade commented Jul 12, 2026

Copy link
Copy Markdown

Adds private scalar and array execution fast paths for MathExpressionEngine.

  • Scalar-only expressions now bypass EngineValue register execution and run on raw Float registers.
  • Float convenience APIs route through the scalar fast path when eligible.
  • Native scalar array comprehensions now parallelize large workloads with DispatchQueue.concurrentPerform.
  • Array construction/comprehension paths pre-size outputs instead of append-growing.
  • Added focused fast-path tests and release benchmarks against swift-math-parser (test only dependency addition)

Prior to changes:

  • Parse/compile: new engine ~14-38x faster.
  • Scalar eval: new engine ~1.8-2.0x slower.
  • Array workload: new engine ~3.5x faster.

Release benchmark summary:

  • Parse/compile: new engine ~14-38x faster.
  • Scalar eval: new engine ~1.3-1.8x faster.
  • Array workload: new engine ~27x faster.

…mediate allocations and when possible, use optimized array access when we have homogenous collections
@vade vade requested a review from tobyspark July 12, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant