@@ -104,25 +104,98 @@ C++ library, here are few brief notes:
104
104
105
105
## Benchmarks
106
106
107
- Below are tables of best timings in nanoseconds for parsing a single number
108
- into a 64-bit float (using the median score).
107
+ Below are tables of best timings in nanoseconds for parsing a single number into a 64-bit float (using the median score, lower is better).
109
108
110
- ### Intel i7-14700K
109
+ <!--
110
+
111
+ Not all C++ benchmarks report ns/float, which we use for our benches.
112
+ You can convert from MFloat/s to ns/float with:
113
+
114
+ ```python
115
+ mfloat_to_ns = lambda x: 1e9 / x / 1e6
116
+ ```
111
117
112
- Intel i7-14700K 3.40GHz, Linux (WSL2), Rust 1.81.
118
+ -->
113
119
114
- | | ` canada ` | ` mesh ` | ` uniform ` | ` bi ` | ` iei ` | ` rec32 ` |
115
- | ---------------------- | -------- | -------- | --------- | ----- | ------ | ------- |
116
- | fast-float2 | 9.98 | 5.56 | 10.08 | 56.19 | 14.52 | 15.09 |
117
- | fast-float | 9.77 | 5.04 | 9.05 | 57.52 | 14.40 | 14.23 |
118
- | lexical | 10.62 | 4.93 | 9.92 | 26.40 | 12.43 | 14.40 |
119
- | from_str | 11.59 | 5.92 | 11.23 | 35.92 | 14.75 | 16.76 |
120
+ ### Intel i7-14700K
121
+
122
+ - CPU: Intel i7-14700K 3.40GHz
123
+ - OS: Ubuntu 24.04 (WSL2)
124
+ - Rust: 1.81
125
+ - C++: GCC 13.2.0
126
+
127
+ | | ` canada ` | ` mesh ` | ` uniform ` | ` bi ` | ` iei ` | ` rec32 ` |
128
+ | ---------------------- | -------- | -------- | --------- | ------ | ------ | ------- |
129
+ | fast-float2 | 9.98 | 5.56 | 10.08 | 56.19 | 14.52 | 15.09 |
130
+ | fast-float | 9.77 | 5.04 | 9.05 | 57.52 | 14.40 | 14.23 |
131
+ | lexical | 10.62 | 4.93 | 9.92 | 26.40 | 12.43 | 14.40 |
132
+ | from_str | 11.59 | 5.92 | 11.23 | 35.92 | 14.75 | 16.76 |
120
133
| fast_float (C++) | 12.58 | 6.35 | 11.86 | 31.55 | 12.22 | 11.97 |
121
134
| abseil (C++) | 25.32 | 15.70 | 25.88 | 43.42 | 23.54 | 26.75 |
122
135
| netlib (C) | 35.10 | 10.22 | 37.72 | 68.63 | 23.07 | 38.23 |
123
136
| strtod (C) | 52.63 | 26.47 | 46.51 | 88.11 | 33.37 | 53.36 |
124
137
| doubleconversion (C++) | 32.50 | 14.69 | 47.80 | 70.01 | 205.72 | 45.66 |
125
138
139
+ ### AMD EPYC 7763 64-Core Processor (Linux)
140
+
141
+ - CPU: AMD EPYC 7763 64-Core Processor 3.20GHz
142
+ - OS: Ubuntu 24.04.1
143
+ - Rust: 1.83
144
+ - C++: GCC 13.2.0
145
+ - Environment: Github Actions (2.321.0)
146
+
147
+ | | ` canada ` | ` mesh ` | ` uniform ` | ` bi ` | ` iei ` | ` rec32 ` |
148
+ | ---------------------- | -------- | -------- | --------- | ------ | ------ | ------- |
149
+ | fast-float2 | 19.83 | 10.42 | 18.64 | 80.03 | 26.12 | 27.70 |
150
+ | fast-float | 19.17 | 9.89 | 17.34 | 82.37 | 25.26 | 27.22 |
151
+ | lexical | 18.89 | 8.41 | 16.83 | 47.66 | 22.08 | 26.99 |
152
+ | from_str | 22.90 | 12.72 | 22.10 | 62.20 | 27.51 | 30.80 |
153
+ | fast_float (C++) | 20.71 | 10.72 | 24.63 | 82.85 | 24.24 | 19.60 |
154
+ | abseil (C++) | 31.03 | 23.78 | 32.82 | 76.05 | 28.41 | 35.03 |
155
+ | netlib (C) | 54.22 | 20.12 | 68.68 | 82.64 | 32.81 | 69.43 |
156
+ | strtod (C) | 100.10 | 52.08 | 85.32 | 192.31 | 75.08 | 97.85 |
157
+ | doubleconversion (C++) | 75.13 | 31.98 | 87.64 | 170.06 | 124.69 | 87.26 |
158
+
159
+ ### AMD EPYC 7763 64-Core Processor (Windows)
160
+
161
+ - CPU: AMD EPYC 7763 64-Core Processor 3.20GHz
162
+ - OS: Windows Server 2022 (10.0.20348)
163
+ - Rust: 1.83
164
+ - C++: MSVC 19.42.34435.0
165
+ - Environment: Github Actions (2.321.0)
166
+
167
+ | | ` canada ` | ` mesh ` | ` uniform ` | ` bi ` | ` iei ` | ` rec32 ` |
168
+ | ---------------------- | -------- | -------- | --------- | ------ | ------ | ------- |
169
+ | fast-float2 | 20.92 | 10.02 | 19.34 | 94.37 | 27.09 | 30.84 |
170
+ | fast-float | 19.72 | 9.65 | 18.46 | 86.85 | 25.75 | 30.05 |
171
+ | lexical | 19.15 | 8.80 | 17.92 | 51.14 | 22.16 | 28.34 |
172
+ | from_str | 25.93 | 13.49 | 23.36 | 78.82 | 27.80 | 35.58 |
173
+ | fast_float (C++) | 64.89 | 47.46 | 64.40 | 104.36 | 55.44 | 69.29 |
174
+ | abseil (C++) | 37.77 | 33.10 | 41.24 | 136.86 | 37.11 | 47.32 |
175
+ | netlib (C) | 53.76 | 28.78 | 60.96 | 76.35 | 44.33 | 62.96 |
176
+ | strtod (C) | 181.47 | 85.95 | 192.35 | 262.81 | 125.37 | 204.94 |
177
+ | doubleconversion (C++) | 119.02 | 28.78 | 128.16 | 232.35 | 110.97 | 129.63 |
178
+
179
+ ### Apple M1 (macOS)
180
+
181
+ - CPU: AMD EPYC 7763 64-Core Processor 3.20GHz
182
+ - OS: macOS (14.7.1)
183
+ - Rust: 1.83
184
+ - C++: Clang (Apple) 15.0.0.15000309
185
+ - Environment: Github Actions
186
+
187
+ | | ` canada ` | ` mesh ` | ` uniform ` | ` bi ` | ` iei ` | ` rec32 ` |
188
+ | ---------------------- | -------- | -------- | --------- | ------ | ------ | ------- |
189
+ | fast-float2 | 15.47 | 6.54 | 11.62 | 94.35 | 20.55 | 17.78 |
190
+ | fast-float | 14.56 | 6.40 | 11.09 | 92.89 | 21.19 | 17.06 |
191
+ | lexical | 14.13 | 6.55 | 11.96 | 35.99 | 15.93 | 18.91 |
192
+ | from_str | 17.67 | 7.93 | 13.88 | 58.60 | 19.68 | 19.92 |
193
+ | fast_float (C++) | 17.42 | 10.40 | 15.14 | 87.33 | 21.82 | 14.53 |
194
+ | abseil (C++) | 20.94 | 17.31 | 22.50 | 63.86 | 24.69 | 25.19 |
195
+ | netlib (C) | 45.05 | 13.79 | 52.38 | 156.25 | 36.10 | 51.36 |
196
+ | strtod (C) | 25.88 | 14.25 | 27.08 | 85.32 | 23.03 | 26.86 |
197
+ | doubleconversion (C++) | 53.39 | 21.50 | 73.15 | 120.63 | 52.88 | 70.47 |
198
+
126
199
Note that the random number generation seems to differ between C/C++ and Rust, since the Rust implementations are slightly faster for pre-determined datasets like ` canada ` and ` mesh ` , but equivalent random number generators are slightly slower. Any performance penalty with ` fast-float2 ` occurred due to fixing the UB in [ check_len] ( https://github.com/aldanor/fast-float-rust/issues/28 ) . The massive performance differences between ` fast-float ` (Rust) and ` fast_float ` (C++) are expected due to a faster fallback algorithms ([ #96 ] ( https://github.com/fastfloat/fast_float/pull/96 ) and [ #104 ] ( https://github.com/fastfloat/fast_float/pull/104 ) ) used in these cases.
127
200
128
201
#### Parsers
0 commit comments