]> git.sesse.net Git - interpreter_trials/commitdiff
started project
authorRune Holm <rune.holm@arm.com>
Wed, 16 Jun 2021 20:40:35 +0000 (22:40 +0200)
committerRune Holm <rune.holm@arm.com>
Wed, 16 Jun 2021 20:41:36 +0000 (22:41 +0200)
.gitignore
interpreter_trials.cpp [new file with mode: 0644]
meson.build [new file with mode: 0644]
subprojects/google-benchmark.wrap [new file with mode: 0644]

index 259148fa18f9fb7ef58563f4ff15fc7b172339fb..89f1a8c2c8bf39608b7fb1f45233d77b9b4b4746 100644 (file)
@@ -30,3 +30,6 @@
 *.exe
 *.out
 *.app
+*~
+subprojects/packagecache
+subprojects/benchmark-1.5.2
diff --git a/interpreter_trials.cpp b/interpreter_trials.cpp
new file mode 100644 (file)
index 0000000..d1183f2
--- /dev/null
@@ -0,0 +1,18 @@
+#include <benchmark/benchmark.h>
+
+static void BM_StringCreation(benchmark::State& state) {
+  for (auto _ : state)
+    std::string empty_string;
+}
+// Register the function as a benchmark
+BENCHMARK(BM_StringCreation);
+
+// Define another benchmark
+static void BM_StringCopy(benchmark::State& state) {
+  std::string x = "hello";
+  for (auto _ : state)
+    std::string copy(x);
+}
+BENCHMARK(BM_StringCopy);
+
+BENCHMARK_MAIN();
diff --git a/meson.build b/meson.build
new file mode 100644 (file)
index 0000000..a0e3e29
--- /dev/null
@@ -0,0 +1,7 @@
+project('interpreter_trials', 'cpp',
+                                                         default_options : ['cpp_std=c++17'])
+
+benchmark_proj = subproject('google-benchmark')
+benchmark_dep = benchmark_proj.get_variable('google_benchmark_dep')
+
+executable('interpreter_trials', 'interpreter_trials.cpp', dependencies : benchmark_dep)
diff --git a/subprojects/google-benchmark.wrap b/subprojects/google-benchmark.wrap
new file mode 100644 (file)
index 0000000..876927d
--- /dev/null
@@ -0,0 +1,9 @@
+[wrap-file]
+directory = benchmark-1.5.2
+source_url = https://github.com/google/benchmark/archive/v1.5.2.zip
+source_filename = benchmark-1.5.2.zip
+source_hash = 21e6e096c9a9a88076b46bd38c33660f565fa050ca427125f64c4a8bf60f336b
+patch_url = https://wrapdb.mesonbuild.com/v1/projects/google-benchmark/1.5.2/1/get_zip
+patch_filename = google-benchmark-1.5.2-1-wrap.zip
+patch_hash = 49f41e4a7e68ac258b6509b9de9857441903be4fb473454c4cba8be885f0c6c3
+