Fields

hardware None
os None

Parameters

Fields

NameValue

Parameters

NameValue
git_commit commit 81b81354f8c117fab07823fef24b97b3a1f47834
Author: Peng Liu <winner245@hotmail.com>
Date: Wed May 21 12:16:40 2025 -0400

[libc++] Optimize bitset::to_string (#128832)

This patch optimizes `bitset::to_string` by replacing the existing bit-by-bit processing with a more efficient
bit traversal strategy. Instead of checking each bit sequentially, we leverage `std::__countr_zero` to efficiently
locate the next set bit, skipping over consecutive zero bits. This greatly accelerates the conversion process,
especially for sparse `bitset`s where zero bits dominate. To ensure similar improvements for dense `bitset`s, we
exploit symmetry by inverting the bit pattern, allowing us to apply the same optimized traversal technique. Even
for uniformly distributed `bitset`s, the proposed approach offers measurable performance gains over the existing
implementation.

Benchmarks demonstrate substantial improvements, achieving up to 13.5x speedup for sparse `bitset`s with
`Pr(true bit) = 0.1`, 16.1x for dense `bitset`s with `Pr(true bit) = 0.9`, and 8.3x for uniformly distributed
`bitset`s with `Pr(true bit) = 0.5)`.
Filter

ldionne-old-macbook-results test results

Run Order Start Time Duration
Current 538271 2025-12-16T16:40:01 0:00:00
Previous 537245 2025-12-16T16:40:01 0:00:00
Baseline 485288 2025-12-16T16:40:01 0:00:00


Tests Summary

Status Group # # (B)
Performance Regressions 7 0
Performance Improvements 2 0
Added Tests 0 18
Unchanged Tests 81 72
Total Tests 90

Performance Regressions - execution_time Δ Previous Current σ Δ (B) σ (B)
710_omnetpp_r 6.22% 8.374 8.895 - 0.00% -
707_ntest_r 2.39% 18.072 18.504 - 0.00% -
721_gcc_r 1.95% 12.954 13.206 - 0.00% -
727_cppcheck_r 1.54% 24.862 25.246 - 0.00% -
748_flightdm_r 1.29% 8.828 8.942 - 0.00% -
709_cactus_r 1.18% 19.772 20.005 - 0.00% -
734_vpr_r 1.17% 15.189 15.367 - 0.00% -

Performance Improvements - execution_time Δ Previous Current σ Δ (B) σ (B)
731_astcenc_r -1.58% 10.298 10.136 - 0.00% -
735_gem5_r -1.54% 14.184 13.966 - 0.00% -

Added Tests - execution_time
706_stockfish_r
707_ntest_r
709_cactus_r
710_omnetpp_r
721_gcc_r
723_llvm_r
727_cppcheck_r
729_abc_r
731_astcenc_r
734_vpr_r
735_gem5_r
736_ocio_r
737_gmsh_r
748_flightdm_r
750_sealcrypto_r
753_ns3_r
766_femflow_r
767_nest_r


Report Time: 0.13s
Name Current %
706_stockfish_r 22.050 -
707_ntest_r 18.504 2.39%
709_cactus_r 20.005 1.18%
710_omnetpp_r 8.895 6.22%
721_gcc_r 13.206 1.95%
723_llvm_r 11.473 -
727_cppcheck_r 25.246 1.54%
729_abc_r 18.537 -
731_astcenc_r 10.136 -1.58%
734_vpr_r 15.367 1.17%
735_gem5_r 13.966 -1.54%
736_ocio_r 16.385 -
737_gmsh_r 12.892 -
748_flightdm_r 8.942 1.29%
750_sealcrypto_r 18.588 -
753_ns3_r 10.697 -
766_femflow_r 12.887 -
767_nest_r 14.143 -
Geometric Mean 14.463 -