Skip to content

[Autoloop] [Autoloop: autoloop-autoloop-tsb-perf-evolve]#191

Closed
github-actions[bot] wants to merge 1 commit intomainfrom
autoloop/autoloop-autoloop-tsb-perf-evolve
Closed

[Autoloop] [Autoloop: autoloop-autoloop-tsb-perf-evolve]#191
github-actions[bot] wants to merge 1 commit intomainfrom
autoloop/autoloop-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.

Program Goal

Evolve Series.sortValues in src/core/series.ts so that tsb runs at least as fast as pandas on a 100k-element float64 Series with 5% NaN.

Metric: fitness = tsb_mean_ms / pandas_mean_ms — lower is better; < 1.0 means tsb wins.

What's in this PR

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

Replaces the original O(N) object-allocation approach (N boxed {v, i} pairs + 2 .map() calls) with:

  1. NaN pre-partition: one O(n) pass separates finite and NaN/null indices into two Uint32Array buffers — removes NaN check from comparator hot path
  2. Indirect index sort: Uint32Array of finite indices sorted in-place via indirect comparator — no boxed objects allocated
  3. Monomorphic comparators: dispatched on ascending before the sort, not inside the comparator — JIT-friendly
  4. Gather via for...of: collects output in a single pass; uses for...of over TypedArray subviews (yields number directly, satisfying noUncheckedIndexedAccess: true)

Hypothesis: eliminating N object allocations + removing NaN from the comparator hot path should significantly reduce GC pressure and improve branch prediction at n=100k.

Current best metric: pending CI

Program issue: #189
State file: autoloop-autoloop-tsb-perf-evolve.md

Generated by Autoloop · ● 5.2M ·

…ion (TypeScript-compliant)

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

- Replace boxed {v,i} pair allocation with Uint32Array index sort (Island 1)
- Pre-partition NaN/null/undefined in O(n) pass (removes NaN check from comparator hot path)
- Dispatch to monomorphic ascending/descending comparators for JIT specialization
- Gather using for...of over TypedArray subviews (fixes noUncheckedIndexedAccess TypeScript errors from c001)
- Eliminates N object allocations → zero GC pressure during sort phase

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

mrjf commented Apr 23, 2026

Closing as a duplicate of #190. This PR was opened on branch autoloop/autoloop-autoloop-tsb-perf-evolve, a doubly-prefixed branch name caused by the scheduler treating the auto-created program issue (#189, titled [Autoloop] [Autoloop: tsb-perf-evolve]) as a separate program from the file-based tsb-perf-evolve. Root cause tracked in #192.

The canonical PR for this program is #190, on branch autoloop/tsb-perf-evolve. Deleting this branch as part of the cleanup.

@mrjf mrjf closed this Apr 23, 2026
@mrjf mrjf deleted the autoloop/autoloop-autoloop-tsb-perf-evolve branch April 23, 2026 05:22
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