aldanor / fast-float-rust

Super-fast float parser in Rust (now part of Rust core)
https://docs.rs/fast-float
Apache License 2.0
275 stars 20 forks source link

Results with AMD Rome (Zen 2) processor #10

Closed lemire closed 3 years ago

lemire commented 3 years ago
$ rustc --version
rustc 1.49.0 (e1884a8e3 2020-12-29)

$ uname -a
Linux rome 3.10.0-1062.4.3.el7.x86_64 #1 SMP Wed Nov 13 23:58:53 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

$ cargo run --release -- file /data/canada.txt
    Finished release [optimized] target(s) in 0.02s
     Running `/home/dlemire/CVS/github/fast-float-rust/target/release/fast-float-simple-bench file /home/dlemire/CVS/github/tmp/fast_double_parser/benchmarks/data/canada.txt`
=====================================================================================
|                         canada.txt (111126, 1.93 MB, f64)                         |
|===================================================================================|
|                                                                                   |
| ns/float                min       5%      25%   median      75%      95%      max |
|-----------------------------------------------------------------------------------|
| fast-float            25.90    25.93    25.98    26.01    26.04    26.06    26.38 |
| lexical               63.18    63.23    63.29    63.33    63.37    63.44    63.57 |
| lexical/lossy         63.25    63.32    63.37    63.41    63.45    63.52    63.78 |
| from_str             190.06   190.23   190.33   190.39   190.46   190.57   203.78 |
|                                                                                   |
| Mfloat/s                min       5%      25%   median      75%      95%      max |
|-----------------------------------------------------------------------------------|
| fast-float            37.90    38.37    38.41    38.45    38.48    38.57    38.60 |
| lexical               15.73    15.76    15.78    15.79    15.80    15.81    15.83 |
| lexical/lossy         15.68    15.74    15.76    15.77    15.78    15.79    15.81 |
| from_str               4.91     5.25     5.25     5.25     5.25     5.26     5.26 |
|                                                                                   |
| MB/s                    min       5%      25%   median      75%      95%      max |
|-----------------------------------------------------------------------------------|
| fast-float           659.60   667.77   668.32   669.13   669.68   671.12   671.74 |
| lexical              273.75   274.29   274.58   274.77   274.95   275.19   275.42 |
| lexical/lossy        272.83   273.94   274.23   274.41   274.59   274.80   275.10 |
| from_str              85.39    91.32    91.36    91.40    91.43    91.47    91.56 |
|                                                                                   |
=====================================================================================

$ cargo run --release -- random uniform
=====================================================================================
|                           uniform (50000, 0.87 MB, f64)                           |
|===================================================================================|
|                                                                                   |
| ns/float                min       5%      25%   median      75%      95%      max |
|-----------------------------------------------------------------------------------|
| fast-float            20.54    20.57    20.58    20.59    20.61    20.70    21.43 |
| lexical               54.78    54.84    54.86    54.88    54.91    54.99    55.72 |
| lexical/lossy         54.77    54.81    54.84    54.86    54.89    54.98    55.76 |
| from_str             103.56   103.63   103.71   103.80   103.90   104.05   104.86 |
|                                                                                   |
| Mfloat/s                min       5%      25%   median      75%      95%      max |
|-----------------------------------------------------------------------------------|
| fast-float            46.65    48.32    48.52    48.57    48.59    48.62    48.68 |
| lexical               17.95    18.19    18.21    18.22    18.23    18.24    18.26 |
| lexical/lossy         17.93    18.19    18.22    18.23    18.24    18.25    18.26 |
| from_str               9.54     9.61     9.62     9.63     9.64     9.65     9.66 |
|                                                                                   |
| MB/s                    min       5%      25%   median      75%      95%      max |
|-----------------------------------------------------------------------------------|
| fast-float           812.97   842.00   845.54   846.33   846.75   847.31   848.21 |
| lexical              312.73   316.89   317.35   317.52   317.64   317.78   318.12 |
| lexical/lossy        312.53   316.96   317.47   317.63   317.77   317.95   318.15 |
| from_str             166.18   167.47   167.72   167.88   168.02   168.15   168.27 |
|                                                                                   |
=====================================================================================
aldanor commented 3 years ago

@lemire Thanks! Would you mind rerunning this in a bit?

I'll finish a PR (hopefully within the hour) that (1) fixes the decimal bug, (2) improves the benching script and adds an all option so you can get the full table at once for fast-float, for all benchmarks, (3) fix the benching itself a bit by removing needless addition operations (use volatile reads instead to prevent code folding), (4) adds a few micro-optimisations to parsing.

Also, it would be nice to get the updated parse_float C++ benchmarks on the same machine (with big-ints changes, and also with the latest decimal changes - although those would only affect 2 of the benchmarks).

aldanor commented 3 years ago

AMD Rome results also added to tables in the README, thanks!