[libcxx-commits] [libcxx] [libc++] Drop char8_t instantiation from string benchmarks (PR #212283)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 27 08:52:11 PDT 2026


https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/212283

The string benchmarks instantiated every benchmark for char, char8_t and wchar_t. char8_t exercises the same code paths as char, so drop it to get roughly a 30% speedup on this benchmark time.

>From 05a35718ce521d744ee24cdb4bfbb8ff41ca895e Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Sat, 25 Jul 2026 07:36:08 -0400
Subject: [PATCH] [libc++] Drop char8_t instantiation from string benchmarks

The string benchmarks instantiated every benchmark for char, char8_t and
wchar_t. char8_t exercises the same code paths as char, so drop it to
get roughly a 30% speedup on this benchmark time.
---
 libcxx/test/benchmarks/containers/string.bench.cpp | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/libcxx/test/benchmarks/containers/string.bench.cpp b/libcxx/test/benchmarks/containers/string.bench.cpp
index 776ee5f58b7e2..26e2f62ad57fe 100644
--- a/libcxx/test/benchmarks/containers/string.bench.cpp
+++ b/libcxx/test/benchmarks/containers/string.bench.cpp
@@ -36,10 +36,6 @@ void bench(std::string name, Func func, Mod modifier = {}) {
     func(std::type_identity<char>(), state);
   })->Apply(modifier);
 
-  benchmark::RegisterBenchmark(rename(name, "u8string"), [=](benchmark::State& state) {
-    func(std::type_identity<char8_t>(), state);
-  })->Apply(modifier);
-
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
   benchmark::RegisterBenchmark(rename(name, "wstring"), [=](benchmark::State& state) {
     func(std::type_identity<wchar_t>(), state);



More information about the libcxx-commits mailing list