Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++] Slight reorganization of the benchmarks #119625

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Dec 11, 2024

Move various container benchmarks to the same subdirectory, and regroup some format-related benchmarks.

Move various container benchmarks to the same subdirectory, and
regroup some format-related benchmarks.
@ldionne ldionne requested a review from a team as a code owner December 11, 2024 22:37
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Dec 11, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 11, 2024

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

Move various container benchmarks to the same subdirectory, and regroup some format-related benchmarks.


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

18 Files Affected:

  • (renamed) libcxx/test/benchmarks/algorithms/algorithms.partition_point.bench.cpp (+2-2)
  • (renamed) libcxx/test/benchmarks/algorithms/lexicographical_compare_three_way.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/containers/ContainerBenchmarks.h (+1-1)
  • (renamed) libcxx/test/benchmarks/containers/deque.bench.cpp (+1-1)
  • (renamed) libcxx/test/benchmarks/containers/deque_iterator.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/containers/map.bench.cpp (+1-1)
  • (renamed) libcxx/test/benchmarks/containers/ordered_set.bench.cpp (+1-1)
  • (renamed) libcxx/test/benchmarks/containers/string.bench.cpp (+2-2)
  • (renamed) libcxx/test/benchmarks/containers/unordered_set_operations.bench.cpp (+1-1)
  • (renamed) libcxx/test/benchmarks/containers/vector_operations.bench.cpp (+1-1)
  • (renamed) libcxx/test/benchmarks/format/format.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/format/format_to.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/format/format_to_n.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/format/formatted_size.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/format/formatter_float.bench.cpp (+1-1)
  • (renamed) libcxx/test/benchmarks/format/formatter_int.bench.cpp (+1-1)
  • (renamed) libcxx/test/benchmarks/format/std_format_spec_string_unicode.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/format/std_format_spec_string_unicode_escape.bench.cpp ()
diff --git a/libcxx/test/benchmarks/algorithms.partition_point.bench.cpp b/libcxx/test/benchmarks/algorithms/algorithms.partition_point.bench.cpp
similarity index 98%
rename from libcxx/test/benchmarks/algorithms.partition_point.bench.cpp
rename to libcxx/test/benchmarks/algorithms/algorithms.partition_point.bench.cpp
index 42ebce8ad2f4ad..0777acbafb5ccb 100644
--- a/libcxx/test/benchmarks/algorithms.partition_point.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/algorithms.partition_point.bench.cpp
@@ -17,8 +17,8 @@
 
 #include "benchmark/benchmark.h"
 
-#include "CartesianBenchmarks.h"
-#include "GenerateInput.h"
+#include "../CartesianBenchmarks.h"
+#include "../GenerateInput.h"
 
 namespace {
 
diff --git a/libcxx/test/benchmarks/lexicographical_compare_three_way.bench.cpp b/libcxx/test/benchmarks/algorithms/lexicographical_compare_three_way.bench.cpp
similarity index 100%
rename from libcxx/test/benchmarks/lexicographical_compare_three_way.bench.cpp
rename to libcxx/test/benchmarks/algorithms/lexicographical_compare_three_way.bench.cpp
diff --git a/libcxx/test/benchmarks/ContainerBenchmarks.h b/libcxx/test/benchmarks/containers/ContainerBenchmarks.h
similarity index 99%
rename from libcxx/test/benchmarks/ContainerBenchmarks.h
rename to libcxx/test/benchmarks/containers/ContainerBenchmarks.h
index 458134c8191d12..6d21e12896ec9e 100644
--- a/libcxx/test/benchmarks/ContainerBenchmarks.h
+++ b/libcxx/test/benchmarks/containers/ContainerBenchmarks.h
@@ -15,7 +15,7 @@
 #include <utility>
 
 #include "benchmark/benchmark.h"
-#include "Utilities.h"
+#include "../Utilities.h"
 #include "test_iterators.h"
 
 namespace ContainerBenchmarks {
diff --git a/libcxx/test/benchmarks/deque.bench.cpp b/libcxx/test/benchmarks/containers/deque.bench.cpp
similarity index 98%
rename from libcxx/test/benchmarks/deque.bench.cpp
rename to libcxx/test/benchmarks/containers/deque.bench.cpp
index ab0ba96b12ffca..7ff1093a9391ca 100644
--- a/libcxx/test/benchmarks/deque.bench.cpp
+++ b/libcxx/test/benchmarks/containers/deque.bench.cpp
@@ -14,7 +14,7 @@
 #include "benchmark/benchmark.h"
 
 #include "ContainerBenchmarks.h"
-#include "GenerateInput.h"
+#include "../GenerateInput.h"
 
 using namespace ContainerBenchmarks;
 
diff --git a/libcxx/test/benchmarks/deque_iterator.bench.cpp b/libcxx/test/benchmarks/containers/deque_iterator.bench.cpp
similarity index 100%
rename from libcxx/test/benchmarks/deque_iterator.bench.cpp
rename to libcxx/test/benchmarks/containers/deque_iterator.bench.cpp
diff --git a/libcxx/test/benchmarks/map.bench.cpp b/libcxx/test/benchmarks/containers/map.bench.cpp
similarity index 99%
rename from libcxx/test/benchmarks/map.bench.cpp
rename to libcxx/test/benchmarks/containers/map.bench.cpp
index 81bdc5077f026f..e37c7d8d551635 100644
--- a/libcxx/test/benchmarks/map.bench.cpp
+++ b/libcxx/test/benchmarks/containers/map.bench.cpp
@@ -14,7 +14,7 @@
 #include <random>
 #include <vector>
 
-#include "CartesianBenchmarks.h"
+#include "../CartesianBenchmarks.h"
 #include "benchmark/benchmark.h"
 #include "test_macros.h"
 
diff --git a/libcxx/test/benchmarks/ordered_set.bench.cpp b/libcxx/test/benchmarks/containers/ordered_set.bench.cpp
similarity index 99%
rename from libcxx/test/benchmarks/ordered_set.bench.cpp
rename to libcxx/test/benchmarks/containers/ordered_set.bench.cpp
index 7883233c23aeee..cb68902c6dcc88 100644
--- a/libcxx/test/benchmarks/ordered_set.bench.cpp
+++ b/libcxx/test/benchmarks/containers/ordered_set.bench.cpp
@@ -17,7 +17,7 @@
 #include <string>
 #include <vector>
 
-#include "CartesianBenchmarks.h"
+#include "../CartesianBenchmarks.h"
 #include "benchmark/benchmark.h"
 #include "test_macros.h"
 
diff --git a/libcxx/test/benchmarks/string.bench.cpp b/libcxx/test/benchmarks/containers/string.bench.cpp
similarity index 99%
rename from libcxx/test/benchmarks/string.bench.cpp
rename to libcxx/test/benchmarks/containers/string.bench.cpp
index 0d7ce2b87bead6..f7da3e2da312b7 100644
--- a/libcxx/test/benchmarks/string.bench.cpp
+++ b/libcxx/test/benchmarks/containers/string.bench.cpp
@@ -13,8 +13,8 @@
 #include <new>
 #include <vector>
 
-#include "CartesianBenchmarks.h"
-#include "GenerateInput.h"
+#include "../CartesianBenchmarks.h"
+#include "../GenerateInput.h"
 #include "benchmark/benchmark.h"
 #include "test_macros.h"
 
diff --git a/libcxx/test/benchmarks/unordered_set_operations.bench.cpp b/libcxx/test/benchmarks/containers/unordered_set_operations.bench.cpp
similarity index 99%
rename from libcxx/test/benchmarks/unordered_set_operations.bench.cpp
rename to libcxx/test/benchmarks/containers/unordered_set_operations.bench.cpp
index 7b1700bfd850d1..a8448ef5a0cfb9 100644
--- a/libcxx/test/benchmarks/unordered_set_operations.bench.cpp
+++ b/libcxx/test/benchmarks/containers/unordered_set_operations.bench.cpp
@@ -18,7 +18,7 @@
 #include "benchmark/benchmark.h"
 
 #include "ContainerBenchmarks.h"
-#include "GenerateInput.h"
+#include "../GenerateInput.h"
 #include "test_macros.h"
 
 using namespace ContainerBenchmarks;
diff --git a/libcxx/test/benchmarks/vector_operations.bench.cpp b/libcxx/test/benchmarks/containers/vector_operations.bench.cpp
similarity index 99%
rename from libcxx/test/benchmarks/vector_operations.bench.cpp
rename to libcxx/test/benchmarks/containers/vector_operations.bench.cpp
index 3a72eaec4dd57e..9449bed31ec38c 100644
--- a/libcxx/test/benchmarks/vector_operations.bench.cpp
+++ b/libcxx/test/benchmarks/containers/vector_operations.bench.cpp
@@ -19,7 +19,7 @@
 
 #include "benchmark/benchmark.h"
 #include "ContainerBenchmarks.h"
-#include "GenerateInput.h"
+#include "../GenerateInput.h"
 
 using namespace ContainerBenchmarks;
 
diff --git a/libcxx/test/benchmarks/format.bench.cpp b/libcxx/test/benchmarks/format/format.bench.cpp
similarity index 100%
rename from libcxx/test/benchmarks/format.bench.cpp
rename to libcxx/test/benchmarks/format/format.bench.cpp
diff --git a/libcxx/test/benchmarks/format_to.bench.cpp b/libcxx/test/benchmarks/format/format_to.bench.cpp
similarity index 100%
rename from libcxx/test/benchmarks/format_to.bench.cpp
rename to libcxx/test/benchmarks/format/format_to.bench.cpp
diff --git a/libcxx/test/benchmarks/format_to_n.bench.cpp b/libcxx/test/benchmarks/format/format_to_n.bench.cpp
similarity index 100%
rename from libcxx/test/benchmarks/format_to_n.bench.cpp
rename to libcxx/test/benchmarks/format/format_to_n.bench.cpp
diff --git a/libcxx/test/benchmarks/formatted_size.bench.cpp b/libcxx/test/benchmarks/format/formatted_size.bench.cpp
similarity index 100%
rename from libcxx/test/benchmarks/formatted_size.bench.cpp
rename to libcxx/test/benchmarks/format/formatted_size.bench.cpp
diff --git a/libcxx/test/benchmarks/formatter_float.bench.cpp b/libcxx/test/benchmarks/format/formatter_float.bench.cpp
similarity index 99%
rename from libcxx/test/benchmarks/formatter_float.bench.cpp
rename to libcxx/test/benchmarks/format/formatter_float.bench.cpp
index ec20eab3c09371..77c067e7bc03e0 100644
--- a/libcxx/test/benchmarks/formatter_float.bench.cpp
+++ b/libcxx/test/benchmarks/format/formatter_float.bench.cpp
@@ -17,7 +17,7 @@
 #include <random>
 #include <string>
 
-#include "CartesianBenchmarks.h"
+#include "../CartesianBenchmarks.h"
 #include "benchmark/benchmark.h"
 
 // *** Localization ***
diff --git a/libcxx/test/benchmarks/formatter_int.bench.cpp b/libcxx/test/benchmarks/format/formatter_int.bench.cpp
similarity index 99%
rename from libcxx/test/benchmarks/formatter_int.bench.cpp
rename to libcxx/test/benchmarks/format/formatter_int.bench.cpp
index db0edab6ae0522..6df0187667aa19 100644
--- a/libcxx/test/benchmarks/formatter_int.bench.cpp
+++ b/libcxx/test/benchmarks/format/formatter_int.bench.cpp
@@ -12,7 +12,7 @@
 #include <format>
 #include <random>
 
-#include "CartesianBenchmarks.h"
+#include "../CartesianBenchmarks.h"
 #include "benchmark/benchmark.h"
 #include "test_macros.h"
 
diff --git a/libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp b/libcxx/test/benchmarks/format/std_format_spec_string_unicode.bench.cpp
similarity index 100%
rename from libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp
rename to libcxx/test/benchmarks/format/std_format_spec_string_unicode.bench.cpp
diff --git a/libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp b/libcxx/test/benchmarks/format/std_format_spec_string_unicode_escape.bench.cpp
similarity index 100%
rename from libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp
rename to libcxx/test/benchmarks/format/std_format_spec_string_unicode_escape.bench.cpp

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 3c464d23682b0f9e6f70965e8f8f3861c9ba5417 b724057e06eae9baf5ac4031bb28cc24710a4967 --extensions cpp,h -- libcxx/test/benchmarks/algorithms/algorithms.partition_point.bench.cpp libcxx/test/benchmarks/algorithms/lexicographical_compare_three_way.bench.cpp libcxx/test/benchmarks/containers/ContainerBenchmarks.h libcxx/test/benchmarks/containers/deque.bench.cpp libcxx/test/benchmarks/containers/deque_iterator.bench.cpp libcxx/test/benchmarks/containers/map.bench.cpp libcxx/test/benchmarks/containers/ordered_set.bench.cpp libcxx/test/benchmarks/containers/string.bench.cpp libcxx/test/benchmarks/containers/unordered_set_operations.bench.cpp libcxx/test/benchmarks/containers/vector_operations.bench.cpp libcxx/test/benchmarks/format/format.bench.cpp libcxx/test/benchmarks/format/format_to.bench.cpp libcxx/test/benchmarks/format/format_to_n.bench.cpp libcxx/test/benchmarks/format/formatted_size.bench.cpp libcxx/test/benchmarks/format/formatter_float.bench.cpp libcxx/test/benchmarks/format/formatter_int.bench.cpp libcxx/test/benchmarks/format/std_format_spec_string_unicode.bench.cpp libcxx/test/benchmarks/format/std_format_spec_string_unicode_escape.bench.cpp
View the diff from clang-format here.
diff --git a/libcxx/test/benchmarks/format/std_format_spec_string_unicode.bench.cpp b/libcxx/test/benchmarks/format/std_format_spec_string_unicode.bench.cpp
index 1c859e1b2b..56cfd07bc8 100644
--- a/libcxx/test/benchmarks/format/std_format_spec_string_unicode.bench.cpp
+++ b/libcxx/test/benchmarks/format/std_format_spec_string_unicode.bench.cpp
@@ -6,15 +6,15 @@
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
 
-#  include <concepts>
-#  include <format>
-#  include <string_view>
+#include <concepts>
+#include <format>
+#include <string_view>
 
-#  include "benchmark/benchmark.h"
-#  include "make_string.h"
-#  include "test_macros.h"
+#include "benchmark/benchmark.h"
+#include "make_string.h"
+#include "test_macros.h"
 
-#  define SV(S) MAKE_STRING_VIEW(CharT, S)
+#define SV(S) MAKE_STRING_VIEW(CharT, S)
 
 #if _LIBCPP_HAS_UNICODE
 
diff --git a/libcxx/test/benchmarks/format/std_format_spec_string_unicode_escape.bench.cpp b/libcxx/test/benchmarks/format/std_format_spec_string_unicode_escape.bench.cpp
index 4a1eb47a71..b66707fded 100644
--- a/libcxx/test/benchmarks/format/std_format_spec_string_unicode_escape.bench.cpp
+++ b/libcxx/test/benchmarks/format/std_format_spec_string_unicode_escape.bench.cpp
@@ -12,13 +12,13 @@
 // datasets to give an impression how the amount of multibyte UTF-8 sequences
 // and larger grapheme clusters affect the performance.
 
-#  include <concepts>
-#  include <format>
-#  include <string_view>
+#include <concepts>
+#include <format>
+#include <string_view>
 
-#  include "benchmark/benchmark.h"
-#  include "make_string.h"
-#  include "test_macros.h"
+#include "benchmark/benchmark.h"
+#include "make_string.h"
+#include "test_macros.h"
 
 #if _LIBCPP_HAS_UNICODE
 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well rename the file to partition_point.bench.cpp?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually want to revisit this file entirely, since it does not benchmark the std::partition_point algorithm :/

@ldionne ldionne merged commit 6a9279c into llvm:main Dec 12, 2024
56 of 64 checks passed
@ldionne ldionne deleted the review/benchmarks-1-reorganize branch December 12, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants