Skip to content

Commit d5c81f5

Browse files
committed
Add benchmark timings for Apple M1 and AMD Rome
1 parent d9e8c95 commit d5c81f5

File tree

1 file changed

+41
-11
lines changed

1 file changed

+41
-11
lines changed

README.md

+41-11
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ There are a few ways this crate is tested:
8282
The presented parser seems to beat all of the existing C/C++/Rust float parsers known to us at the
8383
moment by a large margin, in all of the datasets we tested it on so far – see detailed benchmarks
8484
below (the only exception being the original fast_float C++ library, of course – performance of
85-
which is within noise bounds of this crate). On modern machines, parsing throughput can reach
86-
up to 1GB/s.
85+
which is within noise bounds of this crate). On modern machines like Apple M1, parsing throughput
86+
can reach up to 1.5 GB/s.
8787

8888
In particular, it is faster than Rust standard library's `FromStr::from_str()` by a factor of 2-8x
89-
(larger factor for longer float strings).
89+
(larger factor for longer float strings), and is typically 2-3x faster than the nearest competitors.
9090

9191
While various details regarding the algorithm can be found in the repository for the original
9292
C++ library, here are few brief notes:
@@ -103,21 +103,52 @@ C++ library, here are few brief notes:
103103

104104
## Benchmarks
105105

106-
Below is the table of best timings in nanoseconds for parsing a single number
106+
Below are tables of best timings in nanoseconds for parsing a single number
107107
into a 64-bit float.
108108

109+
#### Intel i7-4771
110+
111+
Intel i7-4771 3.5GHz, macOS, Rust 1.49.
112+
109113
| | `canada` | `mesh` | `uniform` | `iidi` | `iei` | `rec32` |
110114
| ---------------- | -------- | -------- | --------- | ------ | ------ | ------- |
111115
| fast-float | 21.58 | 10.70 | 19.36 | 40.50 | 26.07 | 29.13 |
112116
| lexical | 65.90 | 23.28 | 54.75 | 75.80 | 52.18 | 75.36 |
113-
| lexical/lossy | 65.90 | 23.28 | 54.75 | 75.80 | 52.18 | 75.36 |
114117
| from_str | 174.43 | 22.30 | 99.93 | 227.76 | 111.31 | 204.46 |
115118
| fast_float (C++) | 22.78 | 10.99 | 20.05 | 41.12 | 27.51 | 30.85 |
116119
| abseil (C++) | 42.66 | 32.88 | 46.01 | 50.83 | 46.33 | 49.95 |
117120
| netlib (C++) | 57.53 | 24.86 | 64.72 | 56.63 | 36.20 | 67.29 |
118121
| strtod (C) | 286.10 | 31.15 | 258.73 | 295.73 | 205.72 | 315.95 |
119122

120-
Parsers:
123+
#### Apple M1
124+
125+
Apple M1, macOS, Rust 1.49.
126+
127+
| | `canada` | `mesh` | `uniform` | `iidi` | `iei` | `rec32` |
128+
| ---------------- | -------- | -------- | --------- | ------ | ------ | ------- |
129+
| fast-float | 14.84 | 5.98 | 11.24 | 33.24 | 21.30 | 17.86 |
130+
| lexical | 47.09 | 16.51 | 43.46 | 56.06 | 36.68 | 55.48 |
131+
| from_str | 136.00 | 13.84 | 74.64 | 179.87 | 77.91 | 154.53 |
132+
| fast_float (C++) | 13.71 | 7.28 | 11.71 | 32.94 | 20.64 | 18.30 |
133+
| abseil (C++) | 36.55 | 24.20 | 38.48 | 40.86 | 35.46 | 40.09 |
134+
| netlib (C++) | 47.19 | 14.12 | 48.85 | 52.28 | 33.70 | 48.79 |
135+
| strtod (C) | 176.13 | 21.48 | 165.43 | 187.98 | 132.19 | 190.63 |
136+
137+
#### AMD Rome
138+
139+
AMD Rome, Linux, Rust 1.49.
140+
141+
| | `canada` | `mesh` | `uniform` | `iidi` | `iei` | `rec32` |
142+
| ---------------- | -------- | -------- | --------- | ------ | ------ | ------- |
143+
| fast-float | 25.90 | 12.12 | 20.54 | 47.01 | 29.23 | 32.36 |
144+
| lexical | 63.18 | 22.13 | 54.78 | 81.23 | 55.06 | 79.14 |
145+
| from_str | 190.06 | 26.10 | 102.44 | 239.87 | 119.04 | 211.73 |
146+
| fast_float (C++) | 21.29 | 10.47 | 18.31 | 42.33 | 24.56 | 29.76 |
147+
| abseil (C++) | 44.54 | 34.13 | 47.38 | 52.64 | 43.77 | 53.03 |
148+
| netlib (C++) | 69.43 | 23.31 | 79.98 | 72.17 | 35.81 | 86.91 |
149+
| strtod (C) | 123.37 | 65.68 | 101.58 | 118.36 | 118.61 | 123.72 |
150+
151+
#### Parsers
121152

122153
- `fast-float` - this very crate
123154
- `lexical``lexical_core`, v0.7 (non-lossy; same performance as lossy)
@@ -127,7 +158,7 @@ Parsers:
127158
- `netlib (C++)` – C++ Network Library
128159
- `strtod (C)` – C standard library
129160

130-
Datasets:
161+
#### Datasets
131162

132163
- `canada` – numbers in `canada.txt` file
133164
- `mesh` – numbers in `mesh.txt` file
@@ -136,16 +167,15 @@ Datasets:
136167
- `iei` – random numbers of format `%de%d`
137168
- `rec32` – reciprocals of random 32-bit integers
138169

139-
Notes:
170+
#### Notes
140171

141-
- Test environment: macOS 10.14.6, clang 11.0, Rust 1.49, 3.5 GHz i7-4771 Haswell.
142172
- The two test files referred above can be found in
143173
[this](https://github.com/lemire/simple_fastfloat_benchmark) repository.
144174
- The Rust part of the table (along with a few other benchmarks) can be generated via
145175
the benchmark tool that can be found under `extras/simple-bench` of this repo.
146176
- The C/C++ part of the table (along with a few other benchmarks and parsers) can be
147-
generated via a C++ utility that can be found in [this](https://github.com/lemire/simple_fastfloat_benchmark)
148-
repository.
177+
generated via a C++ utility that can be found in
178+
[this](https://github.com/lemire/simple_fastfloat_benchmark) repository.
149179

150180
<br>
151181

0 commit comments

Comments
 (0)