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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

<details>
<summary>Changes</summary>

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.


---
Full diff: https://github.com/llvm/llvm-project/pull/159525.diff


1 Files Affected:

- (modified) libcxx/test/benchmarks/GenerateInput.h (+1-1) 


``````````diff
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;
 }
 

``````````

</details>


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


More information about the libcxx-commits mailing list