[libcxx-commits] [libcxx] [libc++] Make the benchmarking data pseudo-random (PR #159525)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 18 01:57:22 PDT 2025


https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/159525

Having truly random data makes it quite difficult to compare benchmark results, since a significant amount of difference can simply be due to different input data. Making the data determinisic helps a lot when trying to figure out whether specific changes indeed improve the performance.


>From fd3147a9c4e8a0d6441ef485a5320fd1abf7ee47 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Thu, 18 Sep 2025 10:54:13 +0200
Subject: [PATCH] [libc++] Make the benchmarking data pseudo-random

---
 libcxx/test/benchmarks/GenerateInput.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/test/benchmarks/GenerateInput.h b/libcxx/test/benchmarks/GenerateInput.h
index 06387852f76a6..d07cb8857579d 100644
--- a/libcxx/test/benchmarks/GenerateInput.h
+++ b/libcxx/test/benchmarks/GenerateInput.h
@@ -25,7 +25,7 @@ static const char Letters[] = {
 static const std::size_t LettersSize = sizeof(Letters);
 
 inline std::default_random_engine& getRandomEngine() {
-  static std::default_random_engine RandEngine(std::random_device{}());
+  static std::default_random_engine RandEngine(123456);
   return RandEngine;
 }
 



More information about the libcxx-commits mailing list