Reuse typed heap and numeric accessors

Merged
JA
8d ago
+252-447

Summary

Extract the caller refactorings from #1024 using the typed accessors introduced in #1421 and #1425.

  • Use typed allocation and reads at call sites that expect a single heap payload.
  • Use Value::as_long_int for arithmetic, comparison, and index conversion across interned and heap-backed integers.
  • Share the set storage projection for set, frozenset, and dictionary-view operations.

Validation

  • make format-rs and make lint-rs
  • 1,248 Rust tests passed with memory-model checks enabled
  • 1,628 Python fixture runs passed with CPython 3.14.10
  • An isolated release comparison of the numeric ordering rewrite ran 32 paired samples per workload. The paired median change was −0.84% for wide ordering and −0.34% for ordinary ordering. Both 95% bootstrap intervals included zero.

Summary by cubic

Reworks single-payload call sites to use the typed heap accessors from #1421 and #1425 instead of manual Value::Ref/HeapData dispatch, and routes integer arithmetic, comparison, and index conversion through Value::as_long_int. This extraction from #1024 preserves behavior while shrinking the surface area left for the rest of that refactor.

Refactors

  • set, frozenset, and dict-view operations share one SetStorage projection for equality and set operators.
  • Removes the now-unused LongInt::to_i64 and partial_cmp_f64 helpers; byte-object text extraction routes through Value::as_bytes.

Validation

  • Passes make format-rs, make lint-rs, 1,248 Rust tests with memory-model checks, and 1,628 Python fixture runs.
  • Adds fixture coverage for wide-integer boundary ordering and for dict keys/items views compared against a non-set operand.
  • The numeric ordering rewrite showed no significant regression: paired medians of −0.84% (wide ordering) and −0.34% (ordinary ordering), with both 95% bootstrap intervals including zero.