Skip to content

Perf: avoid redundant unsigned bitwise masks - #1437

Open
fglock wants to merge 2 commits into
masterfrom
perf/runtime-profile-20260919
Open

fglock wants to merge 2 commits into
masterfrom
perf/runtime-profile-20260919

Conversation

@fglock

@fglock fglock commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Summary

Avoid repeated BigInteger modular masks when a numeric bitwise operand or result is already within the unsigned 64-bit range. Negative and out-of-range values retain the existing mask path.

This is a general runtime improvement for ordinary numeric bitwise operations, not a method-body specialization.

Validation

  • Standard Perl: zzzz_iv64_unsigned_bitwise.t passed (17 assertions).
  • PerlOnJava JVM and interpreter: the same boundary suite passed (17 assertions each).
  • Immutable full gate: make passed for b26307132 (/tmp/make-perf-runtime-profile-bitwise-20260919.log).
  • Changelog link validation: make check-links passed (/tmp/check-links-perf-bitwise-mask-20260919.log).

Performance evidence

JFR on the representative Life workload confirms the intended reduction in broad runtime cost:

  • BigInteger.and samples: 237 to 49.
  • BigInteger allocation samples: 692 to 298.
  • int[] allocation samples: 858 to 293.

The complete seven-workload candidate portfolio completed successfully at /tmp/perf-bitwise-mask-production-20260919/20260919T021914Z/portfolio.json. Its Life ratio was 0.442x Perl versus the earlier master artifact's 0.382x; the complete candidate artifact is explicitly non-authoritative because two unrelated JSON JVM warmups did not stabilize.

To attribute the target effect under the production protocol, a sequential protocol-compliant Life B/C/B bracket was run. All three analyzer reports are authoritative and stable:

  • Master A: 0.3789x Perl, /tmp/perf-bitwise-life-bracket-baseline-a-20260919/20260919T030841Z/portfolio.json.
  • Candidate: 0.4470x Perl, /tmp/perf-bitwise-life-bracket-candidate-20260919/20260919T031559Z/portfolio.json.
  • Master B: 0.3839x Perl, /tmp/perf-bitwise-life-bracket-baseline-b-20260919/20260919T032308Z/portfolio.json.

Candidate throughput is 1.172x the geometric mean of the bracketing master controls. This is an incremental Life/workload result, not a claim of whole-portfolio Perl parity.

fglock and others added 2 commits September 19, 2026 04:12
Reuse values already within the unsigned 64-bit range instead of rebuilding
BigInteger backing arrays to apply an identical mask. Negative and out-of-range
values retain the modular masking path.

Generated with Codex (https://openai.com/codex)

Co-Authored-By: Codex <codex@openai.com>
Generated with Codex (https://openai.com/codex)

Co-Authored-By: Codex <codex@openai.com>
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