Skip to content

Add support for testing invalid inputs in benchmarks and generate malformed data#14

Merged
lemire merged 4 commits into
lemire:masterfrom
filipecosta90:malformed
Mar 4, 2026
Merged

Add support for testing invalid inputs in benchmarks and generate malformed data#14
lemire merged 4 commits into
lemire:masterfrom
filipecosta90:malformed

Conversation

@filipecosta90

Copy link
Copy Markdown
Contributor

Command-Line Interface Updates:

  • Added a new --errors flag to enable error testing for invalid inputs. If --errors is provided, invalid inputs are loaded from a file specified by -f/--file.
    • Added malformed_numbers.txt containing 1,000,000 malformed "numbers" for testing purposes.

Implementation details:

  • Modified logic to bypass exceptions for invalid inputs when expect_error is set to true.
  • Updated all parsing functions (e.g., findmax_doubleconversion, findmax_strtod, findmax_netlib, etc.) to accept a new expect_error parameter.

Sample results:

root@hpe3:~/simple_fastfloat_benchmark# ./build/benchmarks/benchmark -f data/malformed_numbers.txt -e
# read 1000000 lines 
ASCII volume = 13.3548 MB 
netlib                                  :   418.68 MB/s (+/- 3.0 %)    31.35 Mfloat/s      10.96 i/B   153.50 i/f (+/- 0.0 %)      8.82 c/B   123.52 c/f (+/- 0.1 %)      1.24 i/c     30.33 b/f    309.07 bm/f      3.87 GHz 
doubleconversion                        :   272.10 MB/s (+/- 2.4 %)    20.37 Mfloat/s      22.40 i/B   313.68 i/f (+/- 0.0 %)     13.51 c/B   189.16 c/f (+/- 0.1 %)      1.66 i/c     63.71 b/f    329.99 bm/f      3.85 GHz 
strtod                                  :   213.13 MB/s (+/- 2.3 %)    15.96 Mfloat/s      28.77 i/B   402.94 i/f (+/- 0.0 %)     17.18 c/B   240.63 c/f (+/- 0.1 %)      1.67 i/c     82.84 b/f    348.90 bm/f      3.84 GHz 
abseil                                  :   294.40 MB/s (+/- 2.6 %)    22.04 Mfloat/s      20.82 i/B   291.57 i/f (+/- 0.0 %)     12.48 c/B   174.71 c/f (+/- 0.2 %)      1.67 i/c     63.69 b/f    280.60 bm/f      3.85 GHz 
fastfloat                               :   433.33 MB/s (+/- 3.1 %)    32.45 Mfloat/s      10.48 i/B   146.75 i/f (+/- 0.0 %)      8.53 c/B   119.42 c/f (+/- 0.1 %)      1.23 i/c     27.96 b/f    277.58 bm/f      3.87 GHz 
UTF-16 volume = 26.7097 MB 
doubleconversion                        :   555.05 MB/s (+/- 2.8 %)    20.78 Mfloat/s      11.32 i/B   317.13 i/f (+/- 0.0 %)      6.62 c/B   185.43 c/f (+/- 0.2 %)      1.71 i/c     67.03 b/f    331.43 bm/f      3.85 GHz 
fastfloat                               :   855.94 MB/s (+/- 2.8 %)    32.05 Mfloat/s       5.30 i/B   148.41 i/f (+/- 0.0 %)      4.31 c/B   120.71 c/f (+/- 0.2 %)      1.23 i/c     27.91 b/f    278.24 bm/f      3.87 GHz 

platform details:

Collection and Platform Info
    Application Command Line:	
    Operating System:	6.8.0-49-generic DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.5 LTS"
    CPU
        Name:	Intel(R) Xeon(R) Processor code named Cascadelake
        Frequency:	2.1 GHz
        Logical CPU Count:	20
        LLC size:	28.8 MB 
        Cache Allocation Technology
            Level 2 capability:	not detected
            Level 3 capability:	available

@lemire

lemire commented Dec 29, 2024

Copy link
Copy Markdown
Owner

Looks reasonable!!!

@lemire
lemire merged commit 861e42f into lemire:master Mar 4, 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