Fix benchmark checksums, enable whitespace skipping, minor cleanups#9
Merged
Fix benchmark checksums, enable whitespace skipping, minor cleanups#9
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
es23.16format produces a leading space thattrim()doesn't strip. fast_float and ffc (following Cfrom_charsconvention) failed every parse silently, inflating reported throughput. Addedadjustl()+volatileanti-DCE + XOR checksums in a separate untimed pass.FMT_SKIP_WSinPRESET_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.canada_short.txtresults.bigint_comparewithsignintrinsic, removeget_double_bits/get_float_bitswrappers in favor of directtransfer.Test plan
fpm test check— 17 tests passfpm test benchmark_compare --profile release— no Infinity, all checksums non-zeroread *, and ffc interop checksums match (correct rounding)