Update README.md

This commit is contained in:
HedgehogInTheCPP 2026-04-08 09:20:06 +03:00 committed by GitHub
parent 7ab7e1cee4
commit aa534f55f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,5 @@
## fast_float number parsing library: 4x faster than strtod
## fast_float HE edition number parsing library.
[![Ubuntu 22.04](https://github.com/irainman/fast_float/actions/workflows/ubuntu22.yml/badge.svg)](https://github.com/irainman/fast_float/actions/workflows/ubuntu22.yml)
[![Ubuntu 22.04 clang](https://github.com/irainman/fast_float/actions/workflows/ubuntu22-clang.yml/badge.svg)](https://github.com/irainman/fast_float/actions/workflows/ubuntu22-clang.yml)
[![Ubuntu 24.04](https://github.com/irainman/fast_float/actions/workflows/ubuntu24.yml/badge.svg)](https://github.com/irainman/fast_float/actions/workflows/ubuntu24.yml)
@ -10,9 +10,74 @@
[![vs17 clang](https://github.com/irainman/fast_float/actions/workflows/vs17-clang-ci.yml/badge.svg)](https://github.com/irainman/fast_float/actions/workflows/vs17-clang-ci.yml)
[![CodeFactor](https://www.codefactor.io/repository/github/irainman/fast_float/badge)](https://www.codefactor.io/repository/github/irainman/fast_float)
*Note: This library is for C++ users. C programmers should consider [ffc.h](https://github.com/kolemannix/ffc.h).
## This is a fork of fast_float made by HedgehogInTheCPP with some additional options, code refactoring and big cleanup to maximize performance, reduce size and improve mainteinability, please give a star to this repo ^^ :
## This is a fork of [fast_float](https://github.com/fastfloat/fast_float) made by HedgehogInTheCPP with some additional options, code refactoring and big cleanup to maximize performance, reduce size and improve mainteinability, please give a star to this repo ^^
### 🚀 Performance and Code Size Improvements
* Optimized parsing logic for use as an **internal lightweight parser** (for example, inside other libraries).
* Reduced binary size by conditionally excluding unneeded parsing features.
* The `from_chars_result_t` structure is reduced to **4 bytes** for better memory efficiency.
* Improved the `parsed_number_string_t` layout and increased `constexpr`/`consteval` propagation to enable compile-time optimizations.
* Reduced register and cache pressure and branching in parsing hot paths.
* Improved performance in both 64-bit and 32-bit builds for all supported types.
---
### ⚙️ New Configuration Macros
Introduced new optional macros to minimize overhead when certain parsing features are not required:
* **`FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN`**
Restricts parsing to **positive C-style numbers only** — no sign characters, no `INF`, `INFINITY`, or `NaN` and no additional options like skip white spaces or support for Fortran or JSON.
* **`FASTFLOAT_ONLY_ROUNDS_TO_NEAREST_SUPPORTED`**
Assumes that only the **IEEE 754 “round-to-nearest”** rounding mode is needed, removing crutches support code for other modes.
* **`FASTFLOAT_ISNOT_CHECKED_BOUNDS`**
Disables bounds checking for input ranges that are assumed to be valid.
Use only when inputs are guaranteed safe — this reduces branching and slightly improves performance.
* **`FASTFLOAT_ASSUME`**
Provides a portable abstraction for the compilers `[[assume]]` intrinsic.
* **`FASTFLOAT_HAS_BYTESWAP`**
Uses std::byteswap if available to reduce code size and speed up.
* **`FASTFLOAT_HAS_BIT_CAST`**
Uses std::bit_cast if available to reduce code size and speed up.
---
### 🧩 Remove Deprecated Macros
* Removed obsolete macroses **`FASTFLOAT_ALLOWS_LEADING_PLUS`** and **`FASTFLOAT_SKIP_WHITE_SPACE`**, which are now superseded by the stricter limited-mode options above.
---
### 🧠 Internal Refactoring and Quality Improvements
* Simplified internal parsing logic with compile-time branching controlled by the new macros.
* Enhanced `constexpr` coverage across the codebase for greater compile-time evaluation.
* Updated benchmarks and tests to validate new restricted configurations.
* Fixed minor compiler warnings and addressed **PVS-Studio** static analysis feedback.
* Properly use FASTFLOAT_SIMD_DISABLE_WARNINGS and FASTFLOAT_SIMD_RESTORE_WARNINGS only for instructions that allow unaligned loads.
* Many small cleanups and fixes.
* Added more comments about functionality and realization details.
---
### 📘 Documentation and Build
* Updated **README.md** to describe all new configuration macros and their intended use cases.
* Adjusted build scripts and benchmark configurations for the new compile-time flags.
---
✅ **Result:**
Smaller, [faster by default](https://github.com/fastfloat/fast_float/pull/307#issuecomment-3775676197), and more configurable builds — now library can be used for **internal numeric parsers** or **embedded environments** — while maintaining full compatibility, functionality, and performance improvements in the default configuration.
🔥 **Motivation:**
There is a really common use case in mathematical and other abstract syntax tree (AST)-like parsers that already processes
the sign and all other symbols before any number by itself. In this case you can use FastFloat to only parse positive numbers
in all supported formats with macros `FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN`, which significantly reduce the code size