Skip to content

chore: remove unused code, unreachable branches and duplicates - #512

Merged
guitarrapc merged 2 commits into
mainfrom
chore/remove-low-risk-waste
Nov 27, 2026
Merged

guitarrapc merged 2 commits into
mainfrom
chore/remove-low-risk-waste

Conversation

@guitarrapc

@guitarrapc guitarrapc commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Removes dead code, unreachable branches and duplicated logic from the library internals. Public API and output are unchanged.

Intent

An audit found code that no caller reaches, branches whose condition is always false or always true, and several copies of the same logic across the three symbologies. Each one costs reading and maintenance time, and gives nothing at run time. This PR keeps only the code that runs.

Before / After

Before After
Structured Append 16-bit lane walk separate NEON and portable implementations one implementation for both
#if guards nested NET10 guards and SIMD_SUPPORTED NET8 only (same code on every target framework)
x64 JIT / x64 NativeAOT code size unchanged
ARM64 NativeAOT identical instruction for instruction
Benchmarks within 10 % on x64, within 2 % on WASM (interpreter and AOT)

Changes

  • Removed unused code:
    • Polynom
    • the capacity tables and VersionInfo
    • ECCInfo.Version and ECCInfo.ErrorCorrectionLevel
    • the short rMQR SelectVersion overloads
    • IsValidISO88591(string)
    • TryGetAlphanumericValue
  • Removed unreachable branches:
    • The Chien search now stops at the L-th root.
    • The Numeric and Alphanumeric decoders no longer check the bits left in each group.
    • Also gone: the AVX2 Rgb24 scalar tail, a redundant Math.Min, a virtual pixel in the alignment row scan, and the BOM compare in the FNC1 Latin loops.
  • Shared duplicated logic:
    • byte widening
    • the luminance size check
    • mapping an ECI to a charset
    • the Micro QR format words
    • the SymbolRenderer draw path
    • the SWAR numeric group, now shared with the alphanumeric table
  • Merged the 16-bit Structured Append lane walk: one implementation now serves both NEON and portable vectors.
  • Simplified the guards: the nested NET10 guards and SIMD_SUPPORTED are now NET8 guards.
  • Fixed review follow-ups: comments and specs are corrected to match the code.

Testing

  • The full test suite passes: 33,296 tests, 0 failed, 403 skipped.
  • Parity tests cover every SIMD path that was merged or trimmed.

🤖 Generated with Claude Code

guitarrapc and others added 2 commits November 27, 2026 19:43
- Remove unused code: Polynom, the capacity tables and VersionInfo, ECCInfo's Version and ErrorCorrectionLevel, the short rMQR SelectVersion overloads, IsValidISO88591(string) and TryGetAlphanumericValue.
- Remove unreachable branches: the Chien search now stops at the L-th root, and Numeric and Alphanumeric no longer check the bits that remain in each group. Also removed: the AVX2 Rgb24 scalar tail, a redundant Math.Min, a virtual pixel in the alignment row scan, and the BOM compare in the FNC1 Latin loops.
- Share duplicates: byte widening, the luminance size check, ECI-to-charset mapping, the Micro QR format words, the SymbolRenderer draw path, and the SWAR numeric group with the alphanumeric table. The 16-bit Structured Append lane walk is now one implementation for NEON and the portable vectors.
- Collapse the nested NET10 guards and SIMD_SUPPORTED into NET8.

Code size is unchanged on x64 JIT. NativeAOT is unchanged on x64 and identical instruction for instruction on ARM64. Benchmarks stay within 10 % on x64 and 2 % on WASM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@guitarrapc
guitarrapc merged commit 5ed30d4 into main Nov 27, 2026
28 checks passed
@guitarrapc
guitarrapc deleted the chore/remove-low-risk-waste branch November 27, 2026 14:04
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