@@ -82,11 +82,11 @@ There are a few ways this crate is tested:
82
82
The presented parser seems to beat all of the existing C/C++/Rust float parsers known to us at the
83
83
moment by a large margin, in all of the datasets we tested it on so far – see detailed benchmarks
84
84
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.
87
87
88
88
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 .
90
90
91
91
While various details regarding the algorithm can be found in the repository for the original
92
92
C++ library, here are few brief notes:
@@ -103,21 +103,52 @@ C++ library, here are few brief notes:
103
103
104
104
## Benchmarks
105
105
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
107
107
into a 64-bit float.
108
108
109
+ #### Intel i7-4771
110
+
111
+ Intel i7-4771 3.5GHz, macOS, Rust 1.49.
112
+
109
113
| | ` canada ` | ` mesh ` | ` uniform ` | ` iidi ` | ` iei ` | ` rec32 ` |
110
114
| ---------------- | -------- | -------- | --------- | ------ | ------ | ------- |
111
115
| fast-float | 21.58 | 10.70 | 19.36 | 40.50 | 26.07 | 29.13 |
112
116
| 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 |
114
117
| from_str | 174.43 | 22.30 | 99.93 | 227.76 | 111.31 | 204.46 |
115
118
| fast_float (C++) | 22.78 | 10.99 | 20.05 | 41.12 | 27.51 | 30.85 |
116
119
| abseil (C++) | 42.66 | 32.88 | 46.01 | 50.83 | 46.33 | 49.95 |
117
120
| netlib (C++) | 57.53 | 24.86 | 64.72 | 56.63 | 36.20 | 67.29 |
118
121
| strtod (C) | 286.10 | 31.15 | 258.73 | 295.73 | 205.72 | 315.95 |
119
122
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
121
152
122
153
- ` fast-float ` - this very crate
123
154
- ` lexical ` – ` lexical_core ` , v0.7 (non-lossy; same performance as lossy)
@@ -127,7 +158,7 @@ Parsers:
127
158
- ` netlib (C++) ` – C++ Network Library
128
159
- ` strtod (C) ` – C standard library
129
160
130
- Datasets:
161
+ #### Datasets
131
162
132
163
- ` canada ` – numbers in ` canada.txt ` file
133
164
- ` mesh ` – numbers in ` mesh.txt ` file
@@ -136,16 +167,15 @@ Datasets:
136
167
- ` iei ` – random numbers of format ` %de%d `
137
168
- ` rec32 ` – reciprocals of random 32-bit integers
138
169
139
- Notes:
170
+ #### Notes
140
171
141
- - Test environment: macOS 10.14.6, clang 11.0, Rust 1.49, 3.5 GHz i7-4771 Haswell.
142
172
- The two test files referred above can be found in
143
173
[ this] ( https://github.com/lemire/simple_fastfloat_benchmark ) repository.
144
174
- The Rust part of the table (along with a few other benchmarks) can be generated via
145
175
the benchmark tool that can be found under ` extras/simple-bench ` of this repo.
146
176
- 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.
149
179
150
180
<br >
151
181
0 commit comments