Skip to content

[Autoloop] [Autoloop: tsb-perf-evolve]#190

Merged
mrjf merged 2 commits intomainfrom
autoloop/tsb-perf-evolve
Apr 23, 2026
Merged

[Autoloop] [Autoloop: tsb-perf-evolve]#190
mrjf merged 2 commits intomainfrom
autoloop/tsb-perf-evolve

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR is maintained by Autoloop. Each accepted iteration adds a commit to this branch.

Goal

Evolve Series.sortValues in src/core/series.ts to minimize the fitness ratio tsb_mean_ms / pandas_mean_ms. A value < 1.0 means tsb is faster than pandas on the benchmark (n=100k floats with 5% NaN).

Program issue: #189
Strategy: AlphaEvolve (MAP-Elites population-based evolution)

Current Best Metric

Pending first CI run (sandbox bun not available for local evaluation).

What's in this branch

Iteration 1 — Island 1: Indirect typed-array sort with NaN pre-partition

  • Replaces the original boxed {v, i} object-pair sort with an indirect Uint32Array index sort
  • Pre-partitions NaN/null/undefined in a single pass — eliminates NaN checks from the comparator hot path
  • Dispatches to one of two monomorphic comparators (ascending vs descending) to help JIT specialize
  • Single gather loop instead of two .map() calls
  • Reduces GC pressure from N object allocations to zero at n=100k

Generated by Autoloop · ● 3.4M ·

Run: https://github.com/githubnext/tsessebe/actions/runs/24815695413

- Replace boxed {v,i} pair allocation with Uint32Array index sort
- Pre-partition NaN/null/undefined in one pass (removes NaN check from comparator hot path)
- Dispatch to one of two monomorphic comparators (ascending vs descending)
- Single gather loop instead of two .map() calls
- Reduces GC pressure from N object allocations to zero

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mrjf mrjf marked this pull request as ready for review April 23, 2026 04:23
noUncheckedIndexedAccess causes Uint32Array element access to return
number | undefined. Since loop bounds guarantee valid indices, use !
to assert non-null and satisfy the type checker.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor Author

Commit pushed: a018e16

Generated by Evergreen — PR Health Keeper

@github-actions
Copy link
Copy Markdown
Contributor Author

Evergreen Fix 🌿

Issue: TypeScript type errors in src/core/series.ts (lines 757–774) — noUncheckedIndexedAccess causes Uint32Array element access to return number | undefined, which can't be assigned to number or used as an index.

Fix: Added non-null assertions (!) to the four nanBuf[i] and finSlice[i] reads in sortValues. The loop bounds (i < nanCount / i < finCount) guarantee these indices are always populated, so the assertions are semantically sound.

Verification: tsc --noEmit exits with code 0 after the fix.

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • releaseassets.githubusercontent.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "releaseassets.githubusercontent.com"

See Network Configuration for more information.

Generated by Evergreen — PR Health Keeper · ● 1.2M ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant