Skip to content

perf: add HybridUint::read fast path for msb_in_token == 0#737

Closed
hjanuschka wants to merge 1 commit into
libjxl:mainfrom
hjanuschka:perf/pr20-hybriduint-msb0-fastpath
Closed

perf: add HybridUint::read fast path for msb_in_token == 0#737
hjanuschka wants to merge 1 commit into
libjxl:mainfrom
hjanuschka:perf/pr20-hybriduint-msb0-fastpath

Conversation

@hjanuschka

@hjanuschka hjanuschka commented Mar 20, 2026

Copy link
Copy Markdown
Collaborator

Carved out from the ongoing perf/autoresearch stream after PR #705 split work.

Change:

  • add a specialized fast path in HybridUint::read for the common msb_in_token == 0 case.

Why:

  • avoids general high-bit reconstruction on a hot path
  • keeps existing behavior

@github-actions

github-actions Bot commented Mar 20, 2026

Copy link
Copy Markdown

Benchmark @ 3ba6a16

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

Comparing: 7cf3a662 (Base) vs 38065842 (PR)

File Base (MP/s) PR (MP/s) Δ%
bicycles.jxl 7.630 7.639 +0.12% ±2.9%
bike.jxl 25.526 25.485 -0.16% ±1.2%
delta_palette.jxl 6.228 6.199 -0.46% ±1.2%
green_queen_modular_e3.jxl 8.422 8.386 -0.43% ±0.3%
green_queen_vardct_e3.jxl 26.003 26.088 +0.33% ±1.2%
lz77_flower.jxl 3.444 3.442 -0.04% ±1.2%
patches_lossless.jxl 3.276 3.273 -0.06% ±0.5%
sunset_logo.jxl 2.893 2.852 -1.43% ±1.3%

Comment thread jxl/src/entropy_coding/hybrid_uint.rs Outdated
@hjanuschka hjanuschka force-pushed the perf/pr20-hybriduint-msb0-fastpath branch from 14427b7 to e5dbeb3 Compare April 2, 2026 07:14
@hjanuschka hjanuschka force-pushed the perf/pr20-hybriduint-msb0-fastpath branch from e5dbeb3 to 3ba6a16 Compare April 2, 2026 07:55
@veluca93

Copy link
Copy Markdown
Member

I'd say that since perf is neutral the additional code complexity is not worth it, so closing it for now.

@veluca93 veluca93 closed this May 29, 2026
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.

2 participants