Optimizing uint64_t Digit Counting: A Method that Beats Lemire's by up to 27%

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Nutrient – The #1 PDF SDK Library, trusted by 10K+ developers
Other PDF SDKs promise a lot - then break. Laggy scrolling, poor mobile UX, tons of bugs, and lack of support cost you endless frustrations. Nutrient’s SDK handles billion-page workloads - so you don’t have to debug PDFs. Used by ~1 billion end users in more than 150 different countries.
www.nutrient.io
featured
CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
  1. BenchmarkSuite

    A suite of benchmarks.

    ```

    This method works by using a static array to hold the precomputed digit counts and another array for threshold values that determine the exact number of digits in a `uint64_t`. The key optimization lies in the efficient use of a bit manipulation technique and direct threshold checking to avoid unnecessary computations.

    ### [Benchmark Results](https://github.com/RealTimeChris/BenchmarkSuite/blob/digit-c...)

    I ran performance benchmarks comparing my new RTC-64-bit method with Lemire’s approach and the traditional `log10` method across various platforms and compilers. The results were consistently impressive:

    #### GCC/Ubuntu:

  2. Nutrient

    Nutrient – The #1 PDF SDK Library, trusted by 10K+ developers. Other PDF SDKs promise a lot - then break. Laggy scrolling, poor mobile UX, tons of bugs, and lack of support cost you endless frustrations. Nutrient’s SDK handles billion-page workloads - so you don’t have to debug PDFs. Used by ~1 billion end users in more than 150 different countries.

    Nutrient logo
  3. rust

    Empowering everyone to build reliable and efficient software.

    This is for integer log 10, but could be adapted for number of digits. It needs a wrapper for 64 bit to invoke it multiple times, but most numbers in a JSON are small, so it might even be competitive; it needs only 4 cycles with enough instruction level parallelism.

    I gathered this idea from the output of a superoptimizer, it was fun to figure out how it works. For spoilers, see [1].

    [1] https://github.com/rust-lang/rust/blob/master/library/core/s...

  4. Jsonifier

    A few classes for extremely fast json parsing/serializing in modern C++. Possibly the fastest json parser in C++. Possibly the fastest json serializer in C++. (by RealTimeChris)

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • How fast can you parse a CSV file in C#?

    4 projects | news.ycombinator.com | 27 Oct 2024
  • P2656: C++ Ecosystem International Standard

    2 projects | /r/cpp | 18 Oct 2022
  • Will C++ ever be as safe as Rust? Does The Standard even care?

    3 projects | /r/programming | 11 Oct 2021
  • Gigabyte Leak Reveals Zen 3 Threadripper CPUs Codenamed 'Chagall'

    2 projects | /r/hardware | 17 Aug 2021
  • Rust Kernel Policy

    3 projects | news.ycombinator.com | 11 Feb 2025

Did you know that C++ is
the 7th most popular programming language
based on number of references?