summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/hana/benchmark/fold_left
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/hana/benchmark/fold_left
parentInitial commit. (diff)
downloadceph-upstream/16.2.11+ds.tar.xz
ceph-upstream/16.2.11+ds.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/hana/benchmark/fold_left')
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/bloat.erb.json38
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/compile.cexpr.recursive.erb.cpp53
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/compile.cexpr.unrolled.erb.cpp43
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/compile.erb.json61
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/compile.fusion.list.erb.cpp31
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/compile.fusion.vector.erb.cpp31
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/compile.hana.basic_tuple.erb.cpp26
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/compile.hana.tuple.erb.cpp25
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/compile.meta.list.erb.cpp25
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/compile.mpl.vector.erb.cpp24
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/compile.mpl11.list.erb.cpp26
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/execute.erb.json32
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/execute.fusion.list.erb.cpp32
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/execute.fusion.vector.erb.cpp32
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/execute.hana.tuple.erb.cpp26
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/execute.std.array.erb.cpp22
-rw-r--r--src/boost/libs/hana/benchmark/fold_left/execute.std.vector.erb.cpp22
17 files changed, 549 insertions, 0 deletions
diff --git a/src/boost/libs/hana/benchmark/fold_left/bloat.erb.json b/src/boost/libs/hana/benchmark/fold_left/bloat.erb.json
new file mode 100644
index 000000000..b3bd9892e
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/bloat.erb.json
@@ -0,0 +1,38 @@
+<%
+ exec = (0..100).step(10).to_a
+ fusion = (0..50).step(10).to_a
+%>
+
+{
+ "title": {
+ "text": "Executable size for fold_left"
+ },
+ "yAxis": {
+ "title": {
+ "text": "Executable size (kb)"
+ },
+ "floor": 0
+ },
+ "tooltip": {
+ "valueSuffix": "kb"
+ },
+ "series": [
+ {
+ "name": "hana::tuple",
+ "data": <%= measure(:bloat, 'execute.hana.tuple.erb.cpp', exec) %>
+ }, {
+ "name": "std::vector",
+ "data": <%= measure(:bloat, 'execute.std.vector.erb.cpp', exec) %>
+ }, {
+ "name": "std::array",
+ "data": <%= measure(:bloat, 'execute.std.array.erb.cpp', exec) %>
+ }
+
+ <% if cmake_bool("@Boost_FOUND@") %>
+ , {
+ "name": "fusion::vector",
+ "data": <%= measure(:bloat, 'execute.fusion.vector.erb.cpp', fusion) %>
+ }
+ <% end %>
+ ]
+} \ No newline at end of file
diff --git a/src/boost/libs/hana/benchmark/fold_left/compile.cexpr.recursive.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/compile.cexpr.recursive.erb.cpp
new file mode 100644
index 000000000..30beb1698
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/compile.cexpr.recursive.erb.cpp
@@ -0,0 +1,53 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+template <typename ...xs>
+struct list { };
+
+template <typename T>
+struct basic_type { using type = T; };
+
+template <typename T>
+constexpr basic_type<T> type{};
+
+
+template <typename x, typename ...xs>
+constexpr auto head(list<x, xs...>)
+{ return type<x>; }
+
+template <typename x, typename ...xs>
+constexpr auto tail(list<x, xs...>)
+{ return list<xs...>{}; }
+
+template <typename F, typename State, typename X, typename ...Xs>
+constexpr auto foldl(F f, State s, list<X, Xs...> xs)
+{ return foldl(f, f(s, head(xs)), tail(xs)); }
+
+template <typename F, typename State>
+constexpr auto foldl(F, State s, list<>)
+{ return s; }
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+struct f {
+ template <typename ...>
+ struct result { };
+
+ template <typename X, typename Y>
+ constexpr auto operator()(X, Y) const
+ { return result<X, Y>{}; }
+};
+
+template <int> struct x { };
+struct state { };
+
+int main() {
+ constexpr auto xs = list<
+ <%= (1..input_size).map { |i| "x<#{i}>" }.join(', ') %>
+ >{};
+
+ constexpr auto result = foldl(f{}, state{}, xs);
+ (void)result;
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/compile.cexpr.unrolled.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/compile.cexpr.unrolled.erb.cpp
new file mode 100644
index 000000000..80fb46f05
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/compile.cexpr.unrolled.erb.cpp
@@ -0,0 +1,43 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/detail/variadic/foldl1.hpp>
+
+
+template <typename ...xs>
+struct list { };
+
+template <typename T>
+struct basic_type { using type = T; };
+
+template <typename T>
+constexpr basic_type<T> type{};
+
+
+template <typename F, typename State, typename ...Xs>
+constexpr auto foldl(F f, State s, list<Xs...> xs)
+{ return boost::hana::detail::variadic::foldl(f, s, type<Xs>...); }
+
+//////////////////////////////////////////////////////////////////////////////
+
+struct f {
+ template <typename ...>
+ struct result { };
+
+ template <typename X, typename Y>
+ constexpr auto operator()(X, Y) const
+ { return result<X, Y>{}; }
+};
+
+template <int> struct x { };
+struct state { };
+
+int main() {
+ constexpr auto xs = list<
+ <%= (1..input_size).map { |i| "x<#{i}>" }.join(', ') %>
+ >{};
+
+ constexpr auto result = foldl(f{}, state{}, xs);
+ (void)result;
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/compile.erb.json b/src/boost/libs/hana/benchmark/fold_left/compile.erb.json
new file mode 100644
index 000000000..7240907a9
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/compile.erb.json
@@ -0,0 +1,61 @@
+<%
+ hana = (0...50).step(5).to_a + (50..400).step(25).to_a
+ fusion = (0..50).step(5)
+ mpl = hana
+ mpl11 = (0...50).step(5).to_a + (50..500).step(25).to_a
+ meta = (0...50).step(5).to_a + (50..200).step(25).to_a
+ cexpr = (0...50).step(5).to_a + (50..200).step(25).to_a
+%>
+
+
+{
+ "title": {
+ "text": "Compile-time behavior of fold_left"
+ },
+ "series": [
+ {
+ "name": "hana::tuple",
+ "data": <%= time_compilation('compile.hana.tuple.erb.cpp', hana) %>
+ }, {
+ "name": "hana::basic_tuple",
+ "data": <%= time_compilation('compile.hana.basic_tuple.erb.cpp', hana) %>
+ }
+
+ <% if cmake_bool("@Boost_FOUND@") %>
+ , {
+ "name": "fusion::vector",
+ "data": <%= time_compilation('compile.fusion.vector.erb.cpp', fusion) %>
+ },{
+ "name": "fusion::list",
+ "data": <%= time_compilation('compile.fusion.list.erb.cpp', fusion) %>
+ }, {
+ "name": "mpl::vector",
+ "data": <%= time_compilation('compile.mpl.vector.erb.cpp', mpl) %>
+ }
+ <% end %>
+
+ <% if cmake_bool("@MPL11_FOUND@") %>
+ , {
+ "name": "mpl11::list",
+ "data": <%= time_compilation('compile.mpl11.list.erb.cpp', mpl11) %>
+ }
+ <% end %>
+
+ <% if cmake_bool("@Meta_FOUND@") %>
+ , {
+ "name": "meta::list",
+ "data": <%= time_compilation('compile.meta.list.erb.cpp', meta) %>
+ }
+ <% end %>
+
+ <% if false %>
+ , {
+ "name": "cexpr::list (recursive)",
+ "data": <%= time_compilation('compile.cexpr.recursive.erb.cpp', cexpr) %>
+ }, {
+ "name": "cexpr::list (unrolled)",
+ "data": <%= time_compilation('compile.cexpr.unrolled.erb.cpp', cexpr) %>
+ }
+ <% end %>
+ ]
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/compile.fusion.list.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/compile.fusion.list.erb.cpp
new file mode 100644
index 000000000..144744a23
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/compile.fusion.list.erb.cpp
@@ -0,0 +1,31 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+<% if input_size > 10 %>
+ #define FUSION_MAX_LIST_SIZE <%= ((input_size + 9) / 10) * 10 %>
+<% end %>
+
+#include <boost/fusion/include/fold.hpp>
+#include <boost/fusion/include/make_list.hpp>
+namespace fusion = boost::fusion;
+
+
+struct f {
+ template <typename State, typename X>
+ constexpr X operator()(State, X x) const { return x; }
+};
+
+struct state { };
+
+template <int i>
+struct x { };
+
+int main() {
+ auto xs = fusion::make_list(
+ <%= (1..input_size).map { |n| "x<#{n}>{}" }.join(', ') %>
+ );
+
+ auto result = fusion::fold(xs, state{}, f{});
+ (void)result;
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/compile.fusion.vector.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/compile.fusion.vector.erb.cpp
new file mode 100644
index 000000000..3a319b351
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/compile.fusion.vector.erb.cpp
@@ -0,0 +1,31 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+<% if input_size > 10 %>
+ #define FUSION_MAX_VECTOR_SIZE <%= ((input_size + 9) / 10) * 10 %>
+<% end %>
+
+#include <boost/fusion/include/fold.hpp>
+#include <boost/fusion/include/make_vector.hpp>
+namespace fusion = boost::fusion;
+
+
+struct f {
+ template <typename State, typename X>
+ constexpr X operator()(State, X x) const { return x; }
+};
+
+struct state { };
+
+template <int i>
+struct x { };
+
+int main() {
+ auto xs = fusion::make_vector(
+ <%= (1..input_size).map { |n| "x<#{n}>{}" }.join(', ') %>
+ );
+
+ auto result = fusion::fold(xs, state{}, f{});
+ (void)result;
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/compile.hana.basic_tuple.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/compile.hana.basic_tuple.erb.cpp
new file mode 100644
index 000000000..c076f3fc9
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/compile.hana.basic_tuple.erb.cpp
@@ -0,0 +1,26 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/fold_left.hpp>
+#include <boost/hana/basic_tuple.hpp>
+namespace hana = boost::hana;
+
+
+struct f {
+ template <typename State, typename X>
+ constexpr X operator()(State, X x) const { return x; }
+};
+
+struct state { };
+
+template <int i>
+struct x { };
+
+int main() {
+ constexpr auto tuple = hana::make_basic_tuple(
+ <%= (1..input_size).map { |n| "x<#{n}>{}" }.join(', ') %>
+ );
+ constexpr auto result = hana::fold_left(tuple, state{}, f{});
+ (void)result;
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/compile.hana.tuple.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/compile.hana.tuple.erb.cpp
new file mode 100644
index 000000000..a245e30c9
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/compile.hana.tuple.erb.cpp
@@ -0,0 +1,25 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/fold_left.hpp>
+#include <boost/hana/tuple.hpp>
+
+
+struct f {
+ template <typename State, typename X>
+ constexpr X operator()(State, X x) const { return x; }
+};
+
+struct state { };
+
+template <int i>
+struct x { };
+
+int main() {
+ constexpr auto tuple = boost::hana::make_tuple(
+ <%= (1..input_size).map { |n| "x<#{n}>{}" }.join(', ') %>
+ );
+ constexpr auto result = boost::hana::fold_left(tuple, state{}, f{});
+ (void)result;
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/compile.meta.list.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/compile.meta.list.erb.cpp
new file mode 100644
index 000000000..cd2ec0f8a
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/compile.meta.list.erb.cpp
@@ -0,0 +1,25 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <meta/meta.hpp>
+
+
+struct f {
+ template <typename, typename>
+ struct apply;
+};
+
+template <int> struct x;
+
+struct state;
+
+using list = meta::list<
+ <%= (1..input_size).map { |i| "x<#{i}>" }.join(', ') %>
+>;
+
+using result = meta::fold<list, state, f>;
+
+int main() {
+
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/compile.mpl.vector.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/compile.mpl.vector.erb.cpp
new file mode 100644
index 000000000..4d5b5b4b6
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/compile.mpl.vector.erb.cpp
@@ -0,0 +1,24 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/push_back.hpp>
+#include <boost/mpl/quote.hpp>
+#include <boost/mpl/vector.hpp>
+
+
+template <typename State, typename X>
+struct f { using type = X; };
+
+struct state { };
+
+template <int i>
+struct t { };
+
+using vector = <%= mpl_vector((1..input_size).to_a.map { |n| "t<#{n}>" }) %>;
+
+using result = boost::mpl::fold<vector, state, boost::mpl::quote2<f>>::type;
+
+
+int main() { }
diff --git a/src/boost/libs/hana/benchmark/fold_left/compile.mpl11.list.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/compile.mpl11.list.erb.cpp
new file mode 100644
index 000000000..cf383ef00
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/compile.mpl11.list.erb.cpp
@@ -0,0 +1,26 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/mpl11/list.hpp>
+
+
+struct f {
+ using type = f;
+ template <typename, typename>
+ struct apply { struct type; };
+};
+
+template <int> struct x { struct type; };
+
+struct state { struct type; };
+
+using list = boost::mpl11::list<
+ <%= (1..input_size).map { |i| "x<#{i}>" }.join(', ') %>
+>;
+
+using result = boost::mpl11::foldl<f, state, list>::type;
+
+int main() {
+
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/execute.erb.json b/src/boost/libs/hana/benchmark/fold_left/execute.erb.json
new file mode 100644
index 000000000..2f7d94559
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/execute.erb.json
@@ -0,0 +1,32 @@
+<%
+ exec = (0..100).step(10).to_a
+ fusion = (0..50).step(10).to_a
+%>
+
+{
+ "title": {
+ "text": "Runtime behavior of fold_left"
+ },
+ "series": [
+ {
+ "name": "hana::tuple",
+ "data": <%= time_execution('execute.hana.tuple.erb.cpp', exec) %>
+ }, {
+ "name": "std::vector",
+ "data": <%= time_execution('execute.std.vector.erb.cpp', exec) %>
+ }, {
+ "name": "std::array",
+ "data": <%= time_execution('execute.std.array.erb.cpp', exec) %>
+ }
+
+ <% if cmake_bool("@Boost_FOUND@") %>
+ , {
+ "name": "fusion::vector",
+ "data": <%= time_execution('execute.fusion.vector.erb.cpp', fusion) %>
+ }, {
+ "name": "fusion::list",
+ "data": <%= time_execution('execute.fusion.list.erb.cpp', fusion) %>
+ }
+ <% end %>
+ ]
+} \ No newline at end of file
diff --git a/src/boost/libs/hana/benchmark/fold_left/execute.fusion.list.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/execute.fusion.list.erb.cpp
new file mode 100644
index 000000000..b71938980
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/execute.fusion.list.erb.cpp
@@ -0,0 +1,32 @@
+// Copyright Louis Dionne 2013-2017
+// Copyright Zach Laine 2014
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+<% if input_size > 10 %>
+ #define FUSION_MAX_LIST_SIZE <%= ((input_size + 9) / 10) * 10 %>
+<% end %>
+
+#include <boost/fusion/include/fold.hpp>
+#include <boost/fusion/include/make_list.hpp>
+
+#include "measure.hpp"
+#include <cstdlib>
+namespace fusion = boost::fusion;
+namespace hana = boost::hana;
+
+
+int main () {
+ hana::benchmark::measure([] {
+ long double result = 0;
+ for (int iteration = 0; iteration < 1 << 10; ++iteration) {
+ auto values = fusion::make_list(
+ <%= input_size.times.map { 'std::rand()' }.join(', ') %>
+ );
+
+ result += fusion::fold(values, 0, [](auto state, auto t) {
+ return state + t;
+ });
+ }
+ });
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/execute.fusion.vector.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/execute.fusion.vector.erb.cpp
new file mode 100644
index 000000000..c733a3be0
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/execute.fusion.vector.erb.cpp
@@ -0,0 +1,32 @@
+// Copyright Louis Dionne 2013-2017
+// Copyright Zach Laine 2014
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+<% if input_size > 10 %>
+ #define FUSION_MAX_VECTOR_SIZE <%= ((input_size + 9) / 10) * 10 %>
+<% end %>
+
+#include <boost/fusion/include/fold.hpp>
+#include <boost/fusion/include/make_vector.hpp>
+
+#include "measure.hpp"
+#include <cstdlib>
+namespace fusion = boost::fusion;
+namespace hana = boost::hana;
+
+
+int main () {
+ hana::benchmark::measure([] {
+ long double result = 0;
+ for (int iteration = 0; iteration < 1 << 10; ++iteration) {
+ auto values = fusion::make_vector(
+ <%= input_size.times.map { 'std::rand()' }.join(', ') %>
+ );
+
+ result += fusion::fold(values, 0, [](auto state, auto t) {
+ return state + t;
+ });
+ }
+ });
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/execute.hana.tuple.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/execute.hana.tuple.erb.cpp
new file mode 100644
index 000000000..622d74f88
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/execute.hana.tuple.erb.cpp
@@ -0,0 +1,26 @@
+// Copyright Louis Dionne 2013-2017
+// Copyright Zach Laine 2014
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/fold_left.hpp>
+#include <boost/hana/tuple.hpp>
+
+#include "measure.hpp"
+#include <cstdlib>
+
+
+int main () {
+ boost::hana::benchmark::measure([] {
+ long double result = 0;
+ for (int iteration = 0; iteration < 1 << 10; ++iteration) {
+ auto values = boost::hana::make_tuple(
+ <%= input_size.times.map { 'std::rand()' }.join(', ') %>
+ );
+
+ result += boost::hana::fold_left(values, 0, [](auto state, auto t) {
+ return state + t;
+ });
+ }
+ });
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/execute.std.array.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/execute.std.array.erb.cpp
new file mode 100644
index 000000000..3961151b6
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/execute.std.array.erb.cpp
@@ -0,0 +1,22 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include "measure.hpp"
+#include <array>
+#include <cstdlib>
+#include <numeric>
+
+
+int main () {
+ boost::hana::benchmark::measure([] {
+ long long result = 0;
+ for (int iteration = 0; iteration < 1 << 10; ++iteration) {
+ std::array<int, <%= input_size %>> values = {{
+ <%= input_size.times.map { 'std::rand()' }.join(', ') %>
+ }};
+
+ result += std::accumulate(values.begin(), values.end(), 0);
+ }
+ });
+}
diff --git a/src/boost/libs/hana/benchmark/fold_left/execute.std.vector.erb.cpp b/src/boost/libs/hana/benchmark/fold_left/execute.std.vector.erb.cpp
new file mode 100644
index 000000000..703b6fbcc
--- /dev/null
+++ b/src/boost/libs/hana/benchmark/fold_left/execute.std.vector.erb.cpp
@@ -0,0 +1,22 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include "measure.hpp"
+#include <cstdlib>
+#include <numeric>
+#include <vector>
+
+
+int main () {
+ boost::hana::benchmark::measure([] {
+ long long result = 0;
+ for (int iteration = 0; iteration < 1 << 10; ++iteration) {
+ std::vector<int> values = {
+ <%= input_size.times.map { 'std::rand()' }.join(', ') %>
+ };
+
+ result += std::accumulate(values.begin(), values.end(), 0);
+ }
+ });
+}