Skip to content

feat: migrate skyborn-plot C cores to unified Pure-Rust skybornplot._plot_rs - #1

Merged
QianyeSu merged 2 commits into
mainfrom
feat/pure-rust-plot-core
Nov 30, 2026
Merged

QianyeSu merged 2 commits into
mainfrom
feat/pure-rust-plot-core

Conversation

@QianyeSu

Copy link
Copy Markdown
Member

Summary

  • Migrates all compiled C99 plotting kernels (_ncl_curly_core, _contour_core, contour_arrows_core) into a unified Pure-Rust Cargo workspace (rust/skybornplot-core + rust/skybornplot-py -> skybornplot._plot_rs) with PyO3 (0.30), numpy (0.30), and Rayon (1.12) parallelism.
  • Adds batched native kernels trace_ncl_glyphs_batch (Rayon-parallel curly-vector glyph tracing wired into vector.py / _core/vector_engine.py with fallback preserved) and build_swept_arrow_segments (wired into _core/contour_arrows.py).
  • Preserves 100% API compatibility via Python shims (nclcurly_core/_ncl_curly_core.py, contour_core/_contour_core.py, _core/contour_arrows_core.py).
  • Archives legacy C99/Meson sources and setup.py into c_ref/ (excluded from wheels and sdists via [tool.maturin] exclude), switches packaging to maturin>=1.0,<2.0 (0.2.0), adds tools/with_ramdisk.sh, and updates .github/workflows/{ci,build-wheels}.yml.

Verification Highlights

  • Rust tests & docs: 26/26 skybornplot-core unit tests passing, 0 warnings under RUSTDOCFLAGS="-D warnings" cargo doc --workspace --exclude skybornplot-py --no-deps and cargo check --release -p skybornplot-py.
  • Packaging: --profile dist wheel (426,517 bytes) and maturin sdist (103,320 bytes) verified with 0 c_ref/, .c, meson.build, setup.py, __pycache__, or .pyc entries.
  • Python tests: 448 passed, 1 skipped (test_curly_vector_with_transform), 0 failed, including 12/12 in tests/test_rust_parity.py.
  • Parity & Performance vs v0.1.0 C oracle:
    • 16-function parity: exact discrete index/mask equality (0.000e+00) and float64 parity max_abs <= 1.705e-13 (max_rel <= 4.322e-15).
    • curly_vector (181x360): 2.88x end-to-end speedup (49.85 ms vs 143.57 ms, Peak RSS 176.75 MiB vs 177.83 MiB); 4,000-seed batch kernel 13.15x faster (4.62 ms vs 60.72 ms).
    • Dense cell scatter (scatter(..., placement='cells') on 181x360, 4.68M candidates): 2.24x end-to-end speedup (170.32 ms vs 381.27 ms) with parity Peak RSS (484.48 MiB vs 482.33 MiB).
    • Swept contour arrows (arrow_contour 181x360): 1.53x end-to-end speedup (58.38 ms vs 89.15 ms), and 21.42x speedup on the 400x200 swept polyline kernel (12.11 ms vs 259.26 ms).

@QianyeSu
QianyeSu merged commit 58f0c49 into main Nov 30, 2026
14 of 16 checks passed
@QianyeSu
QianyeSu deleted the feat/pure-rust-plot-core branch November 30, 2026 20:38
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