How is rust packed_simd killed when portable-simd cant replace it in context of mozilla firefox 115?:
Good question — and this is where the real technical wall is. Short answer first, then the concrete blockers.
portable_simd isn’t “killed”; it’s not a drop-in replacement for what Firefox 115 is doing with packed_simd. The problem is not ideology or conservatism — it’s API shape, guarantees, and codegen assumptions.
I’ll be precise and stay high-signal.
packed_simd exposed a value-level, fixed-width SIMD API with predictable lowering that Firefox-era code relies on.
portable_simd (std::simd) is a type-driven, target-feature-mediated API whose semantics and optimizer behavior do not match what encoding_rs and rand are written around — especially on stable Rust at the time ESR 115 targets.
You don’t lose SIMD, but you lose the invariants the code assumes.
packed_simd gave Firefox three things std::simd does not (yet) guarantee:
Example used by encoding_rs:
use packed_simd::u8x16;This means:
- Exactly 16 lanes
- Always vectorized
- No runtime dispatch
- No feature probing
- No monomorphization explosion
The code is written assuming one concrete type.
Firefox does this intentionally:
RUSTC_BOOTSTRAP=encoding_rs,packed_simd
That allows:
- use of unstable SIMD intrinsics
- bypassing feature gating
- consistent codegen across platforms
std::simd explicitly does not allow this.
This matters more than people admit.
Firefox relies on:
- vector loads not scalarized
- predictable mask lowering
- stable alignment behavior
packed_simd was essentially a compiler co-design experiment.
std::simd is not.
Let’s go through the real blockers.
In std::simd:
use core::simd::Simd;
type U8x16 = Simd<u8, 16>;Sounds fine — but:
- Requires const generics support maturity
- Triggers heavy monomorphization
- Breaks code that assumes concrete layout
- Changes trait resolution and inlining
encoding_rs is not written generically.
It assumes monomorphic SIMD.
packed_simd:
let mask: m8x16 = a.eq(b);- mask is a vector
- can be bitcast
- can be reduced cheaply
std::simd:
let mask = a.simd_eq(b); // SimdMask- opaque mask type
- different reduction APIs
- backend-dependent lowering
- harder to force optimal codegen
Encoding hot loops depend on this.
std::simd requires either:
#[target_feature(enable = "...")]- or runtime feature detection
Both are poison for Firefox 115 because:
- functions get duplicated
- inlining behavior changes
- build times explode
- perf cliffs appear on some CPUs
Firefox intentionally avoids per-function dispatch here.
At the Rust version Firefox 115 is pinned to:
- missing reductions
- missing casts
- missing shuffle ops
- partial operator coverage
You end up:
- reimplementing ops manually
- or falling back to scalar paths
Either way, performance parity is gone.
rand’s SIMD paths:
- rely on bulk sampling
- assume cheap lane extraction
- use packed arithmetic
std::simd makes these patterns:
- more verbose
- harder to optimize
- more fragile to compiler changes
This isn’t theoretical — multiple upstream rand PRs stalled on this.
Mozilla could afford to do it if it were easy.
They haven’t because:
- perf regressions were measurable
- cross-arch behavior diverged
- CI signal-to-noise was bad
- ESR stability matters more than API purity
This isn’t inertia — it’s engineering cost.
All of these must be true:
- Higher MSRV (newer Rust)
- Explicitly monomorphic SIMD types
- No runtime dispatch
- Equivalent mask lowering
- Benchmark-validated parity
Firefox 115 satisfies none of these simultaneously.
The only credible approach is:
-
Write a compat shim:
pub struct u8x16(Simd<u8, 16>);
-
Re-expose
packed_simd-like API -
Force
#[inline(always)] -
Avoid masks where possible
-
Pin target features globally
That is weeks of work, not days — and it still may regress.
portable_simdis not immature- It is architecturally different
- Firefox 115’s SIMD code assumes properties it does not guarantee
- Using it without regressions requires an upstream-scale rewrite
You’re not wrong to want to move forward — but the wall you’re hitting is real, not superstition.
If you want, next I can:
- Sketch a minimal compatibility layer design
- Identify exact functions where parity breaks
- Estimate realistic engineering time
- Or help you decide where to accept controlled regressions vs keep SIMD