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 537799 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 4 0
Performance Improvements 2 0
Added Tests 0 18
Unchanged Tests 84 72
Total Tests 90

Performance Regressions - execution_time Δ Previous Current σ Δ (B) σ (B)
710_omnetpp_r 3.31% 8.610 8.895 - 0.00% -
721_gcc_r 1.76% 12.978 13.206 - 0.00% -
709_cactus_r 1.71% 19.669 20.005 - 0.00% -
750_sealcrypto_r 1.10% 18.386 18.588 - 0.00% -

Performance Improvements - execution_time Δ Previous Current σ Δ (B) σ (B)
723_llvm_r -2.71% 11.793 11.473 - 0.00% -
748_flightdm_r -1.01% 9.033 8.942 - 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.70s
Name Current %
706_stockfish_r 22.050 -
707_ntest_r 18.504 -
709_cactus_r 20.005 1.71%
710_omnetpp_r 8.895 3.31%
721_gcc_r 13.206 1.76%
723_llvm_r 11.473 -2.71%
727_cppcheck_r 25.246 -
729_abc_r 18.537 -
731_astcenc_r 10.136 -
734_vpr_r 15.367 -
735_gem5_r 13.966 -
736_ocio_r 16.385 -
737_gmsh_r 12.892 -
748_flightdm_r 8.942 -1.01%
750_sealcrypto_r 18.588 1.10%
753_ns3_r 10.697 -
766_femflow_r 12.887 -
767_nest_r 14.143 -
Geometric Mean 14.463 -