Skip to content

Fix benchmark checksums, enable whitespace skipping, minor cleanups#9

Merged
perazz merged 5 commits intomainfrom
fix/benchmark-checksums
Mar 26, 2026
Merged

Fix benchmark checksums, enable whitespace skipping, minor cleanups#9
perazz merged 5 commits intomainfrom
fix/benchmark-checksums

Conversation

@perazz
Copy link
Copy Markdown
Owner

@perazz perazz commented Mar 26, 2026

Summary

  • Fix benchmark leading-space bug: es23.16 format produces a leading space that trim() doesn't strip. fast_float and ffc (following C from_chars convention) failed every parse silently, inflating reported throughput. Added adjustl() + volatile anti-DCE + XOR checksums in a separate untimed pass.
  • Enable FMT_SKIP_WS in PRESET_GENERAL: All parse functions now skip leading whitespace by default, matching Fortran convention (read *, stdlib, str2real all skip whitespace). The flag was already implemented but not wired into the default.
  • Update README benchmarks with corrected numbers and add canada_short.txt results.
  • Minor cleanups: simplify bigint_compare with sign intrinsic, remove get_double_bits/get_float_bits wrappers in favor of direct transfer.

Test plan

  • fpm test check — 17 tests pass
  • fpm test benchmark_compare --profile release — no Infinity, all checksums non-zero
  • fast_float, read *, and ffc interop checksums match (correct rounding)

perazz added 5 commits March 26, 2026 22:05
The es23.16 format produces a leading space for positive numbers.
trim() only strips trailing blanks, so fast_float and ffc (which
follow C from_chars convention: no whitespace skipping) failed every
parse silently. Use adjustl() to left-justify before trimming.

Add XOR-based checksums computed in a separate untimed pass over all
parsed values, replacing the old max-only checksum that only captured
the last repeat's maximum. Mark answer as volatile to prevent the
compiler from eliminating the timed loops in release builds.
Previous random-uniform results were inflated for fast_float and ffc
because leading spaces caused all parses to fail silently. These are
the real numbers after the adjustl fix.

Also add canada_short.txt results and remove stale profiling section
(profile_benchmark.sh was deleted earlier).
Add FMT_SKIP_WS to PRESET_GENERAL so all parse functions skip leading
whitespace by default. This matches Fortran convention (read *, stdlib,
str2real all skip whitespace) and the upstream ffc.h library which has
FFC_FORMAT_FLAG_SKIP_WHITE_SPACE for the same purpose.

Keep adjustl in benchmark data generation so the C interop path (which
uses ffc_from_chars_double without options) also gets clean input.
@perazz perazz merged commit 1f0087f into main Mar 26, 2026
18 checks passed
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