[PATCH] D53087: Add benchmarks for std::function.

Eric Fiselier via Phabricator reviews at reviews.llvm.org
Wed Oct 10 11:26:16 PDT 2018


EricWF added a comment.

Just an FYI. Currently we build the benchmarks as C++17. So I think it's fair to go nuts with C++17 features where they make these benchmarks better.



================
Comment at: benchmarks/CartesianBenchmarks.hpp:1
+
+#include <string>
----------------
Please add the standard license header here.


================
Comment at: benchmarks/CartesianBenchmarks.hpp:82
+template <class T>
+__attribute__((always_inline)) inline T maybeOpaque(T value, bool opaque) {
+  if (opaque) benchmark::DoNotOptimize(value);
----------------
Let's replace the raw attributes with the `TEST_ALWAYS_INLINE` defined in `test/support/test_macros.h' (PS. 'test/support' is passed via -I, so you only need to write #include "test_macros.h")


================
Comment at: benchmarks/function.bench.cpp:1
+
+#include <cstdint>
----------------
Please add the standard license header here.


================
Comment at: benchmarks/function.bench.cpp:210
+int main(int argc, char** argv) {
+  ::benchmark::Initialize(&argc, argv);
+  if (::benchmark::ReportUnrecognizedArguments(argc, argv))
----------------
I don't love the need to fully qualify the `benchmark` namespace. Perhaps we can do something better?


Repository:
  rCXX libc++

https://reviews.llvm.org/D53087





More information about the libcxx-commits mailing list