A Fast 64-Bit Date Algorithm (30–40% faster by counting dates backwards)
18 days ago
- #algorithm
- #date-conversion
- #optimization
- A new fast date conversion algorithm is presented, offering significant speed improvements over previous methods.
- The algorithm is optimized for 64-bit systems, with a 32-bit fallback option, and supports a wide date range of ±1.89 trillion years.
- Key innovations include reducing expensive computations from 7+ to just 4 multiplications and introducing a reverse timeline counting method.
- Detailed benchmark results show the algorithm outperforms previous fastest methods by up to 43.7% on tested hardware.
- The article explains the algorithm's design, including epoch adjustments, division optimizations, and platform-specific optimizations for ARM and x64.
- Range and accuracy are thoroughly discussed, confirming the algorithm's suitability for full 64-bit UNIX time processing.
- The implementation is released as free open-source software under the BSL-1.0 License.