Skip to content

perf: optimize noise hot path and inline RNG helpers#708

Open
hjanuschka wants to merge 1 commit intolibjxl:mainfrom
hjanuschka:perf/pr02-noise-hotpath-inline
Open

perf: optimize noise hot path and inline RNG helpers#708
hjanuschka wants to merge 1 commit intolibjxl:mainfrom
hjanuschka:perf/pr02-noise-hotpath-inline

Conversation

@hjanuschka
Copy link
Collaborator

@hjanuschka hjanuschka commented Mar 16, 2026

This speeds up noise rendering by removing per-element u64 splitting branches and reusing a direct u32 view of the RNG batch. It also inlines Noise::strength and Xorshift128Plus::fill in hot call paths. Unsafe is used only for a temporary [u64; N] to [u32; 2N] reinterpret cast, which is safe because the layouts are identical and the data is read-only.

@github-actions
Copy link

Benchmark @ 1a54821

MULTI-FILE BENCHMARK RESULTS (4 files)
  CPU architecture: x86_64
  WARNING: System appears noisy: high system load (2.35). Results may be unreliable.
Statistics:
  Confidence:               99.0%
  Max relative error:        3.0%

Comparing: e883140e (Base) vs bf26387b (PR)

File Base (MP/s) PR (MP/s) Δ%
bike.jxl 24.244 24.178 -0.27% ±2.7%
green_queen_modular_e3.jxl 7.925 7.872 -0.66% ±0.9%
green_queen_vardct_e3.jxl 23.854 23.877 +0.10% ±1.4%
sunset_logo.jxl 2.788 2.786 -0.09% ±1.4%

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