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 538269 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 1 0
Added Tests 0 18
Unchanged Tests 85 72
Total Tests 90

Performance Regressions - execution_time Δ Previous Current σ Δ (B) σ (B)
735_gem5_r 1.74% 13.728 13.966 - 0.00% -
709_cactus_r 1.73% 19.664 20.005 - 0.00% -
721_gcc_r 1.68% 12.988 13.206 - 0.00% -
707_ntest_r 1.39% 18.250 18.504 - 0.00% -

Performance Improvements - execution_time Δ Previous Current σ Δ (B) σ (B)
710_omnetpp_r -6.16% 9.479 8.895 - 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.15s
Name Current %
706_stockfish_r 22.050 -
707_ntest_r 18.504 1.39%
709_cactus_r 20.005 1.73%
710_omnetpp_r 8.895 -6.16%
721_gcc_r 13.206 1.68%
723_llvm_r 11.473 -
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 1.74%
736_ocio_r 16.385 -
737_gmsh_r 12.892 -
748_flightdm_r 8.942 -
750_sealcrypto_r 18.588 -
753_ns3_r 10.697 -
766_femflow_r 12.887 -
767_nest_r 14.143 -
Geometric Mean 14.463 -