Skip to content

Commit 41385eb

Browse files
robot-pigletblinkov
authored andcommitted
Update contrib/restricted/fast_float to 8.0.0
commit_hash:65d9b3d669fb4794d962c6233c5fe43eb098bb9d
1 parent d379239 commit 41385eb

File tree

12 files changed

+609
-174
lines changed

12 files changed

+609
-174
lines changed

contrib/restricted/fast_float/.yandex_meta/devtools.licenses.report

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ BELONGS ya.make
3939
Match type : TAG
4040
Links : http://opensource.org/licenses/mit-license.php, https://spdx.org/licenses/MIT
4141
Files with this license:
42-
README.md [513:513]
42+
README.md [535:535]
4343

4444
KEEP BSL-1.0 2c7a3fa82e66676005cd4ee2608fd7d2
4545
BELONGS ya.make
@@ -76,7 +76,20 @@ FILE_INCLUDE AUTHORS found in files: LICENSE-MIT at line 23
7676
Files with this license:
7777
LICENSE-MIT [5:27]
7878

79-
KEEP Apache-2.0 AND MIT 5eed35bbf652e4d32c909d95331a0c79
79+
KEEP Apache-2.0 79f65f9f30b137f9b03d455de6cfdac9
80+
BELONGS ya.make
81+
License text:
82+
Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
83+
2.0</a> or <a href="LICENSE-MIT">MIT license</a> or <a
84+
Scancode info:
85+
Original SPDX id: Apache-2.0
86+
Score : 100.00
87+
Match type : REFERENCE
88+
Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0
89+
Files with this license:
90+
README.md [534:535]
91+
92+
KEEP Apache-2.0 AND MIT a76785199b4beee1ba8a8173f3d43241
8093
BELONGS ya.make
8194
Note: matched license text is too long. Read it in the source files.
8295
Scancode info:
@@ -85,27 +98,14 @@ BELONGS ya.make
8598
Match type : NOTICE
8699
Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0
87100
Files with this license:
88-
README.md [507:520]
101+
README.md [529:544]
89102
Scancode info:
90103
Original SPDX id: MIT
91104
Score : 49.30
92105
Match type : NOTICE
93106
Links : http://opensource.org/licenses/mit-license.php, https://spdx.org/licenses/MIT
94107
Files with this license:
95-
README.md [507:520]
96-
97-
KEEP Apache-2.0 79f65f9f30b137f9b03d455de6cfdac9
98-
BELONGS ya.make
99-
License text:
100-
Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
101-
2.0</a> or <a href="LICENSE-MIT">MIT license</a> or <a
102-
Scancode info:
103-
Original SPDX id: Apache-2.0
104-
Score : 100.00
105-
Match type : REFERENCE
106-
Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0
107-
Files with this license:
108-
README.md [512:513]
108+
README.md [529:544]
109109

110110
KEEP BSL-1.0 AND BSL-1.0 a8fd7a0ddc7793219e50dfdeb4742dfc
111111
BELONGS ya.make
@@ -117,14 +117,14 @@ BELONGS ya.make
117117
Match type : REFERENCE
118118
Links : http://www.boost.org/LICENSE_1_0.txt, http://www.boost.org/users/license.html, https://spdx.org/licenses/BSL-1.0
119119
Files with this license:
120-
README.md [514:514]
120+
README.md [536:536]
121121
Scancode info:
122122
Original SPDX id: BSL-1.0
123123
Score : 99.00
124124
Match type : REFERENCE
125125
Links : http://www.boost.org/LICENSE_1_0.txt, http://www.boost.org/users/license.html, https://spdx.org/licenses/BSL-1.0
126126
Files with this license:
127-
README.md [514:514]
127+
README.md [536:536]
128128

129129
KEEP Apache-2.0 c48d93dbb5419f7a8844879928a2fda7
130130
BELONGS ya.make
@@ -136,7 +136,7 @@ BELONGS ya.make
136136
Match type : NOTICE
137137
Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0
138138
Files with this license:
139-
README.md [507:507]
139+
README.md [529:529]
140140

141141
KEEP Apache-2.0 OR MIT OR BSL-1.0 dbfbb7aa50e4925e728f16d4a8adf7d9
142142
BELONGS ya.make
@@ -148,14 +148,14 @@ BELONGS ya.make
148148
Match type : INTRO
149149
Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/unknown-license-reference.LICENSE
150150
Files with this license:
151-
README.md [512:512]
151+
README.md [534:534]
152152
Scancode info:
153153
Original SPDX id: Apache-2.0
154154
Score : 90.00
155155
Match type : TAG
156156
Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0
157157
Files with this license:
158-
README.md [512:512]
158+
README.md [534:534]
159159

160160
KEEP Apache-2.0 fb21a7d67961597593aefff800484f8d
161161
BELONGS ya.make

contrib/restricted/fast_float/.yandex_meta/licenses.list.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
210210
href="LICENSE-BOOST">BOOST license</a>.
211211
</sup>
212212

213+
<br/>
214+
213215
<sub>
214216
Unless you explicitly state otherwise, any contribution intentionally submitted
215217
for inclusion in this repository by you, as defined in the Apache-2.0 license,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
self: super: with self; rec {
22
name = "fast_float";
3-
version = "7.0.0";
3+
version = "8.0.0";
44

55
src = fetchFromGitHub {
66
owner = "fastfloat";
77
repo = "fast_float";
88
rev = "v${version}";
9-
hash = "sha256-CG5je117WYyemTe5PTqznDP0bvY5TeXn8Vu1Xh5yUzQ=";
9+
hash = "sha256-shP+me3iqTRrsPGYrvcbnJNRZouQbW62T24xfkEgGSE=";
1010
};
1111
}

contrib/restricted/fast_float/README.md

Lines changed: 62 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
## fast_float number parsing library: 4x faster than strtod
33

4-
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/fast_float.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:fast_float)
54
[![Ubuntu 22.04 CI (GCC 11)](https://github.com/fastfloat/fast_float/actions/workflows/ubuntu22.yml/badge.svg)](https://github.com/fastfloat/fast_float/actions/workflows/ubuntu22.yml)
65

76
The fast_float library provides fast header-only implementations for the C++
@@ -16,22 +15,22 @@ floating-point numbers with a C++17-like syntax (the library itself only
1615
requires C++11):
1716

1817
```C++
19-
from_chars_result from_chars(const char* first, const char* last, float& value, ...);
20-
from_chars_result from_chars(const char* first, const char* last, double& value, ...);
18+
from_chars_result from_chars(char const *first, char const *last, float &value, ...);
19+
from_chars_result from_chars(char const *first, char const *last, double &value, ...);
2120
```
2221
2322
You can also parse integer types:
2423
2524
```C++
26-
from_chars_result from_chars(const char* first, const char* last, int& value, ...);
27-
from_chars_result from_chars(const char* first, const char* last, unsigned& value, ...);
25+
from_chars_result from_chars(char const *first, char const *last, int &value, ...);
26+
from_chars_result from_chars(char const *first, char const *last, unsigned &value, ...);
2827
```
2928

3029
The return type (`from_chars_result`) is defined as the struct:
3130

3231
```C++
3332
struct from_chars_result {
34-
const char* ptr;
33+
char const *ptr;
3534
std::errc ec;
3635
};
3736
```
@@ -60,7 +59,7 @@ Example:
6059
#include <iostream>
6160
6261
int main() {
63-
const std::string input = "3.1416 xyz ";
62+
std::string input = "3.1416 xyz ";
6463
double result;
6564
auto answer = fast_float::from_chars(input.data(), input.data() + input.size(), result);
6665
if (answer.ec != std::errc()) { std::cerr << "parsing failure\n"; return EXIT_FAILURE; }
@@ -72,7 +71,7 @@ int main() {
7271
You can parse delimited numbers:
7372

7473
```C++
75-
const std::string input = "234532.3426362,7869234.9823,324562.645";
74+
std::string input = "234532.3426362,7869234.9823,324562.645";
7675
double result;
7776
auto answer = fast_float::from_chars(input.data(), input.data() + input.size(), result);
7877
if (answer.ec != std::errc()) {
@@ -108,9 +107,9 @@ The library seeks to follow the C++17 (see
108107
[28.2.3.(6.1)](https://eel.is/c++draft/charconv.from.chars#6.1)) specification.
109108
110109
* The `from_chars` function does not skip leading white-space characters (unless
111-
`fast_float::chars_format::chars_format` is set).
110+
`fast_float::chars_format::skip_white_space` is set).
112111
* [A leading `+` sign](https://en.cppreference.com/w/cpp/utility/from_chars) is
113-
forbidden (unless `fast_float::chars_format::skip_white_space` is set).
112+
forbidden (unless `fast_float::chars_format::allow_leading_plus` is set).
114113
* It is generally impossible to represent a decimal value exactly as binary
115114
floating-point number (`float` and `double` types). We seek the nearest value.
116115
We round to an even mantissa when we are in-between two binary floating-point
@@ -119,8 +118,8 @@ The library seeks to follow the C++17 (see
119118
Furthermore, we have the following restrictions:
120119
121120
* We support `float` and `double`, but not `long double`. We also support
122-
fixed-width floating-point types such as `std::float32_t` and
123-
`std::float64_t`.
121+
fixed-width floating-point types such as `std::float64_t`, `std::float32_t`,
122+
`std::float16_t`, and `std::bfloat16_t`.
124123
* We only support the decimal format: we do not support hexadecimal strings.
125124
* For values that are either very large or very small (e.g., `1e9999`), we
126125
represent it using the infinity or negative infinity value and the returned
@@ -143,31 +142,31 @@ following code will print the number 22250738585072012 three times:
143142
144143
int main() {
145144
uint64_t i;
146-
const char str[] = "22250738585072012";
147-
auto answer = fast_float::from_chars(str, str + strlen(str), i);
145+
std::string str = "22250738585072012";
146+
auto answer = fast_float::from_chars(str.data(), str.data() + str.size(), i);
148147
if (answer.ec != std::errc()) {
149148
std::cerr << "parsing failure\n";
150149
return EXIT_FAILURE;
151150
}
152-
std::cout << "parsed the number "<< i << std::endl;
151+
std::cout << "parsed the number " << i << std::endl;
153152
154-
const char binstr[] = "1001111000011001110110111001001010110100111000110001100";
153+
std::string binstr = "1001111000011001110110111001001010110100111000110001100";
155154
156-
answer = fast_float::from_chars(binstr, binstr + strlen(binstr), i, 2);
155+
answer = fast_float::from_chars(binstr.data(), binstr.data() + binstr.size(), i, 2);
157156
if (answer.ec != std::errc()) {
158157
std::cerr << "parsing failure\n";
159158
return EXIT_FAILURE;
160159
}
161-
std::cout << "parsed the number "<< i << std::endl;
160+
std::cout << "parsed the number " << i << std::endl;
162161
163-
const char hexstr[] = "4f0cedc95a718c";
162+
std::string hexstr = "4f0cedc95a718c";
164163
165-
answer = fast_float::from_chars(hexstr, hexstr + strlen(hexstr), i, 16);
164+
answer = fast_float::from_chars(hexstr.data(), hexstr.data() + hexstr.size(), i, 16);
166165
if (answer.ec != std::errc()) {
167166
std::cerr << "parsing failure\n";
168167
return EXIT_FAILURE;
169168
}
170-
std::cout << "parsed the number "<< i << std::endl;
169+
std::cout << "parsed the number " << i << std::endl;
171170
return EXIT_SUCCESS;
172171
}
173172
```
@@ -242,7 +241,8 @@ constexpr double constexptest() {
242241
## C++23: Fixed width floating-point types
243242

244243
The library also supports fixed-width floating-point types such as
245-
`std::float32_t` and `std::float64_t`. E.g., you can write:
244+
`std::float64_t`, `std::float32_t`, `std::float16_t`, and `std::bfloat16_t`.
245+
E.g., you can write:
246246

247247
```C++
248248
std::float32_t result;
@@ -259,7 +259,7 @@ following example:
259259
#include <iostream>
260260

261261
int main() {
262-
const std::u16string input = u"3.1416 xyz ";
262+
std::u16string input = u"3.1416 xyz ";
263263
double result;
264264
auto answer = fast_float::from_chars(input.data(), input.data() + input.size(), result);
265265
if (answer.ec != std::errc()) { std::cerr << "parsing failure\n"; return EXIT_FAILURE; }
@@ -282,7 +282,7 @@ separator (e.g., the comma). You may use it as follows.
282282
#include <iostream>
283283

284284
int main() {
285-
const std::string input = "3,1416 xyz ";
285+
std::string input = "3,1416 xyz ";
286286
double result;
287287
fast_float::parse_options options{fast_float::chars_format::general, ','};
288288
auto answer = fast_float::from_chars_advanced(input.data(), input.data() + input.size(), result, options);
@@ -299,9 +299,9 @@ int main() {
299299
#include <iostream>
300300

301301
int main() {
302-
const std::string input = "1d+4";
302+
std::string input = "1d+4";
303303
double result;
304-
fast_float::parse_options options{ fast_float::chars_format::fortran };
304+
fast_float::parse_options options{fast_float::chars_format::fortran};
305305
auto answer = fast_float::from_chars_advanced(input.data(), input.data() + input.size(), result, options);
306306
if ((answer.ec != std::errc()) || ((result != 10000))) { std::cerr << "parsing failure\n"; return EXIT_FAILURE; }
307307
std::cout << "parsed the number " << result << std::endl;
@@ -316,9 +316,9 @@ int main() {
316316
#include <iostream>
317317

318318
int main() {
319-
const std::string input = "+.1"; // not valid
319+
std::string input = "+.1"; // not valid
320320
double result;
321-
fast_float::parse_options options{ fast_float::chars_format::json };
321+
fast_float::parse_options options{fast_float::chars_format::json};
322322
auto answer = fast_float::from_chars_advanced(input.data(), input.data() + input.size(), result, options);
323323
if (answer.ec == std::errc()) { std::cerr << "should have failed\n"; return EXIT_FAILURE; }
324324
return EXIT_SUCCESS;
@@ -332,9 +332,9 @@ By default the JSON format does not allow `inf`:
332332
#include <iostream>
333333

334334
int main() {
335-
const std::string input = "inf"; // not valid in JSON
335+
std::string input = "inf"; // not valid in JSON
336336
double result;
337-
fast_float::parse_options options{ fast_float::chars_format::json };
337+
fast_float::parse_options options{fast_float::chars_format::json};
338338
auto answer = fast_float::from_chars_advanced(input.data(), input.data() + input.size(), result, options);
339339
if (answer.ec == std::errc()) { std::cerr << "should have failed\n"; return EXIT_FAILURE; }
340340
return EXIT_SUCCESS;
@@ -348,9 +348,9 @@ You can allow it with a non-standard `json_or_infnan` variant:
348348
#include <iostream>
349349

350350
int main() {
351-
const std::string input = "inf"; // not valid in JSON but we allow it with json_or_infnan
351+
std::string input = "inf"; // not valid in JSON but we allow it with json_or_infnan
352352
double result;
353-
fast_float::parse_options options{ fast_float::chars_format::json_or_infnan };
353+
fast_float::parse_options options{fast_float::chars_format::json_or_infnan};
354354
auto answer = fast_float::from_chars_advanced(input.data(), input.data() + input.size(), result, options);
355355
if (answer.ec != std::errc() || (!std::isinf(result))) { std::cerr << "should have parsed infinity\n"; return EXIT_FAILURE; }
356356
return EXIT_SUCCESS;
@@ -367,7 +367,7 @@ The fast_float library is part of:
367367
* [WebKit](https://github.com/WebKit/WebKit), the engine behind Safari (Apple's
368368
web browser),
369369
* [DuckDB](https://duckdb.org),
370-
* [Redis](https://github.com/redis/redis),
370+
* [Redis](https://github.com/redis/redis) and [Valkey](https://github.com/valkey-io/valkey),
371371
* [Apache Arrow](https://github.com/apache/arrow/pull/8494) where it multiplied
372372
the number parsing speed by two or three times,
373373
* [Google Jsonnet](https://github.com/google/jsonnet),
@@ -429,8 +429,7 @@ abseil : 430.45 MB/s (+/- 2.2 %) 20.52 Mfl
429429
fastfloat : 1042.38 MB/s (+/- 9.9 %) 49.68 Mfloat/s
430430
```
431431

432-
See <https://github.com/lemire/simple_fastfloat_benchmark> for our benchmarking
433-
code.
432+
See the [Benchmarking](#benchmarking) Section for instructions on how to run our benchmarks.
434433

435434
## Video
436435

@@ -456,7 +455,7 @@ sufficiently recent version of CMake (3.11 or better at least):
456455
FetchContent_Declare(
457456
fast_float
458457
GIT_REPOSITORY https://github.com/fastfloat/fast_float.git
459-
GIT_TAG tags/v6.1.6
458+
GIT_TAG tags/v8.0.0
460459
GIT_SHALLOW TRUE)
461460
462461
FetchContent_MakeAvailable(fast_float)
@@ -472,7 +471,7 @@ You may also use [CPM](https://github.com/cpm-cmake/CPM.cmake), like so:
472471
CPMAddPackage(
473472
NAME fast_float
474473
GITHUB_REPOSITORY "fastfloat/fast_float"
475-
GIT_TAG v6.1.6)
474+
GIT_TAG v8.0.0)
476475
```
477476

478477
## Using as single header
@@ -484,7 +483,30 @@ if desired as described in the command line help.
484483

485484
You may directly download automatically generated single-header files:
486485

487-
<https://github.com/fastfloat/fast_float/releases/download/v7.0.0/fast_float.h>
486+
<https://github.com/fastfloat/fast_float/releases/download/v8.0.0/fast_float.h>
487+
488+
## Benchmarking
489+
490+
The project has its own benchmarks with realistic data inputs. Under Linux or macOS,
491+
you can use it as follows if your system supports C++17:
492+
493+
```
494+
cmake -B build -D FASTFLOAT_BENCHMARKS=ON
495+
cmake --build build
496+
./build/benchmarks/realbenchmark
497+
```
498+
499+
Importantly, by default, the benchmark is built in Release mode.
500+
501+
The instructions are similar under Windows.
502+
503+
Under Linux and macOS, it is recommended to run the benchmarks in a privileged manner to get access
504+
to hardware performance counters. You may be able to do so with the `sudo` command
505+
in some cases:
506+
507+
```
508+
sudo ./build/benchmarks/realbenchmark
509+
```
488510

489511
## Packages
490512

@@ -514,6 +536,8 @@ Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
514536
href="LICENSE-BOOST">BOOST license</a>.
515537
</sup>
516538

539+
<br/>
540+
517541
<sub>
518542
Unless you explicitly state otherwise, any contribution intentionally submitted
519543
for inclusion in this repository by you, as defined in the Apache-2.0 license,

0 commit comments

Comments
 (0)