benchcc 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/benchcc.gemspec +1 -1
- data/lib/benchcc/benchmark.rb +4 -6
- data/lib/benchcc/version.rb +1 -1
- data/spec/benchmark_spec.rb +7 -7
- metadata +4 -26
- data/benchmarks/fmap/_env.rb +0 -3
- data/benchmarks/fmap/_main.erb +0 -7
- data/benchmarks/fmap/hana_list.erb.cpp +0 -18
- data/benchmarks/fmap/mpl11_list.erb.cpp +0 -15
- data/benchmarks/fmap/mpl_list.erb.cpp +0 -15
- data/benchmarks/fmap/mpl_vector.erb.cpp +0 -15
- data/benchmarks/tuple_create/_env.rb +0 -3
- data/benchmarks/tuple_create/boost_tuple.erb.cpp +0 -6
- data/benchmarks/tuple_create/fusion_tuple.erb.cpp +0 -6
- data/benchmarks/tuple_create/hana_list.erb.cpp +0 -6
- data/benchmarks/tuple_create/std_tuple.erb.cpp +0 -6
- data/benchmarks/tuple_last/_env.rb +0 -3
- data/benchmarks/tuple_last/boost_tuple.erb.cpp +0 -7
- data/benchmarks/tuple_last/fusion_tuple.erb.cpp +0 -7
- data/benchmarks/tuple_last/hana_list.erb.cpp +0 -7
- data/benchmarks/tuple_last/std_tuple.erb.cpp +0 -7
- data/benchmarks/value_foldl/_env.rb +0 -3
- data/benchmarks/value_foldl/_main.erb +0 -17
- data/benchmarks/value_foldl/fusion_cons.erb.cpp +0 -8
- data/benchmarks/value_foldl/fusion_list.erb.cpp +0 -9
- data/benchmarks/value_foldl/fusion_vector.erb.cpp +0 -9
- data/benchmarks/value_foldl/hana_list.erb.cpp +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54612ab25b2af557fc641b9ccfaefcbc043ff5eb
|
4
|
+
data.tar.gz: ae13a4cbd526c90c51dc19f3db4e942903f5fc93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8ecedf598268b9173a0031521608bd5f8113a889790eab123281266b08611f046b448ce67f8f50edf0fa51d31d34cb8bf4671dcfc20ca00e4b32fd588dd4fe5
|
7
|
+
data.tar.gz: d6fe33c29a832ef6c1bf9e050d7bdd159a87e1d2ecc631dd856713cfcc545e85dc70be2c2e915162e593119cfad92e03dda5030095aa92f747fb4eab6d5d9666
|
data/benchcc.gemspec
CHANGED
data/lib/benchcc/benchmark.rb
CHANGED
@@ -20,19 +20,17 @@ module Benchcc
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def benchmark(file, envs, timeout: 10, relative_to: File.dirname(file), &block)
|
23
|
+
def benchmark(file, envs, timeout: 10, relative_to: File.dirname(file), stderr: $stderr, &block)
|
24
24
|
progress = ProgressBar.create(format: "#{file} %p%% | %B |",
|
25
25
|
total: envs.size)
|
26
|
-
|
26
|
+
data = []
|
27
27
|
envs.each do |env|
|
28
|
-
break if consecutive_errors >= 2
|
29
28
|
code = Renderer.new(relative_to).render(file, **env)
|
30
29
|
begin
|
31
30
|
Timeout::timeout(timeout) { data << env.merge(block.call(code).to_h) }
|
32
|
-
consecutive_errors = 0
|
33
31
|
rescue CompilationError, Timeout::Error => e
|
34
|
-
|
35
|
-
|
32
|
+
stderr << e
|
33
|
+
break
|
36
34
|
end
|
37
35
|
progress.increment
|
38
36
|
end
|
data/lib/benchcc/version.rb
CHANGED
data/spec/benchmark_spec.rb
CHANGED
@@ -6,18 +6,18 @@ require 'timeout'
|
|
6
6
|
|
7
7
|
|
8
8
|
describe Benchcc.method(:benchmark) do
|
9
|
-
it('should
|
9
|
+
it('should stop on timeout') {
|
10
10
|
timeout = 0.3
|
11
|
-
envs = [{time: timeout + 0.1}, {time: timeout - 0.
|
12
|
-
{time: timeout + 0.2}, {time: timeout - 0.2}]
|
11
|
+
envs = [{time: timeout - 0.1}, {time: timeout + 0.1}, {time: timeout - 0.2}]
|
13
12
|
Tempfile.create('') do |file|
|
14
|
-
file.write('<%= time %>')
|
15
|
-
|
16
|
-
|
13
|
+
file.write('<%= time %>') && file.flush
|
14
|
+
devnull = File.open(File::NULL, 'w')
|
15
|
+
|
16
|
+
data = Benchcc.benchmark(file.path, envs, timeout: timeout, stderr: devnull) do |code|
|
17
17
|
sleep(code.to_f)
|
18
18
|
{time: code.to_f}
|
19
19
|
end
|
20
|
-
expect(data).to eq(envs.
|
20
|
+
expect(data).to eq(envs.take_while { |env| env[:time] < timeout })
|
21
21
|
end
|
22
22
|
}
|
23
23
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benchcc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Louis Dionne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gnuplot
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.0
|
61
|
+
version: '2.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.0
|
68
|
+
version: '2.0'
|
69
69
|
description: Benchcc is a collection of utilities to make easier the task of benchmarking
|
70
70
|
C++ metaprograms
|
71
71
|
email:
|
@@ -82,12 +82,6 @@ files:
|
|
82
82
|
- Rakefile
|
83
83
|
- benchcc.gemspec
|
84
84
|
- benchmarks/Rakefile
|
85
|
-
- benchmarks/fmap/_env.rb
|
86
|
-
- benchmarks/fmap/_main.erb
|
87
|
-
- benchmarks/fmap/hana_list.erb.cpp
|
88
|
-
- benchmarks/fmap/mpl11_list.erb.cpp
|
89
|
-
- benchmarks/fmap/mpl_list.erb.cpp
|
90
|
-
- benchmarks/fmap/mpl_vector.erb.cpp
|
91
85
|
- benchmarks/include/_env.rb
|
92
86
|
- benchmarks/include/hana.erb.cpp
|
93
87
|
- benchmarks/include/mpl.erb.cpp
|
@@ -97,16 +91,6 @@ files:
|
|
97
91
|
- benchmarks/sum/_main.erb
|
98
92
|
- benchmarks/sum/constexpr.erb.cpp
|
99
93
|
- benchmarks/sum/mpl11_variadic_foldl.erb.cpp
|
100
|
-
- benchmarks/tuple_create/_env.rb
|
101
|
-
- benchmarks/tuple_create/boost_tuple.erb.cpp
|
102
|
-
- benchmarks/tuple_create/fusion_tuple.erb.cpp
|
103
|
-
- benchmarks/tuple_create/hana_list.erb.cpp
|
104
|
-
- benchmarks/tuple_create/std_tuple.erb.cpp
|
105
|
-
- benchmarks/tuple_last/_env.rb
|
106
|
-
- benchmarks/tuple_last/boost_tuple.erb.cpp
|
107
|
-
- benchmarks/tuple_last/fusion_tuple.erb.cpp
|
108
|
-
- benchmarks/tuple_last/hana_list.erb.cpp
|
109
|
-
- benchmarks/tuple_last/std_tuple.erb.cpp
|
110
94
|
- benchmarks/type_foldl/_env.rb
|
111
95
|
- benchmarks/type_foldl/_main.erb
|
112
96
|
- benchmarks/type_foldl/hana_list.erb.cpp
|
@@ -114,12 +98,6 @@ files:
|
|
114
98
|
- benchmarks/type_foldl/mpl11_list.erb.cpp
|
115
99
|
- benchmarks/type_foldl/mpl_list.erb.cpp
|
116
100
|
- benchmarks/type_foldl/mpl_vector.erb.cpp
|
117
|
-
- benchmarks/value_foldl/_env.rb
|
118
|
-
- benchmarks/value_foldl/_main.erb
|
119
|
-
- benchmarks/value_foldl/fusion_cons.erb.cpp
|
120
|
-
- benchmarks/value_foldl/fusion_list.erb.cpp
|
121
|
-
- benchmarks/value_foldl/fusion_vector.erb.cpp
|
122
|
-
- benchmarks/value_foldl/hana_list.erb.cpp
|
123
101
|
- lib/benchcc.rb
|
124
102
|
- lib/benchcc/benchmark.rb
|
125
103
|
- lib/benchcc/compiler.rb
|
data/benchmarks/fmap/_env.rb
DELETED
data/benchmarks/fmap/_main.erb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
#include <boost/hana/list.hpp>
|
2
|
-
|
3
|
-
|
4
|
-
template <typename X>
|
5
|
-
struct _f { };
|
6
|
-
|
7
|
-
constexpr struct {
|
8
|
-
template <typename X>
|
9
|
-
constexpr _f<X> operator()(X) const;
|
10
|
-
} f{};
|
11
|
-
|
12
|
-
<%=
|
13
|
-
render('_main.erb') do |xs, breadth, depth|
|
14
|
-
xs = xs.map { |x| "#{x}{}" }.join(', ')
|
15
|
-
list = "boost::hana::list(#{xs})"
|
16
|
-
"static const auto go#{breadth} = boost::hana::fmap(f, #{list});"
|
17
|
-
end
|
18
|
-
%>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
#include <boost/mpl11/list.hpp>
|
2
|
-
|
3
|
-
|
4
|
-
struct f {
|
5
|
-
using type = f;
|
6
|
-
template <typename>
|
7
|
-
struct apply { struct type; };
|
8
|
-
};
|
9
|
-
|
10
|
-
<%=
|
11
|
-
render('_main.erb') do |xs, breadth, depth|
|
12
|
-
list = "boost::mpl11::list<#{xs.join(', ')}>"
|
13
|
-
"using go#{breadth} = boost::mpl11::fmap<f, #{list}>::type;"
|
14
|
-
end
|
15
|
-
%>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
#include <boost/mpl/transform.hpp>
|
2
|
-
<%= Benchcc::MPL::List.new(0...depth).includes %>
|
3
|
-
|
4
|
-
|
5
|
-
struct f {
|
6
|
-
template <typename>
|
7
|
-
struct apply { struct type; };
|
8
|
-
};
|
9
|
-
|
10
|
-
<%=
|
11
|
-
render('_main.erb') do |xs, breadth, depth|
|
12
|
-
list = Benchcc::MPL::List.new(xs)
|
13
|
-
"using go#{breadth} = boost::mpl::transform<#{list}, f>::type;"
|
14
|
-
end
|
15
|
-
%>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
#include <boost/mpl/transform.hpp>
|
2
|
-
<%= Benchcc::MPL::Vector.new(0...depth).includes %>
|
3
|
-
|
4
|
-
|
5
|
-
struct f {
|
6
|
-
template <typename>
|
7
|
-
struct apply { struct type; };
|
8
|
-
};
|
9
|
-
|
10
|
-
<%=
|
11
|
-
render('_main.erb') do |xs, breadth, depth|
|
12
|
-
vector = Benchcc::MPL::Vector.new(xs)
|
13
|
-
"using go#{breadth} = boost::mpl::transform<#{vector}, f>::type;"
|
14
|
-
end
|
15
|
-
%>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
template <typename ...>
|
2
|
-
struct result { };
|
3
|
-
|
4
|
-
constexpr struct {
|
5
|
-
template <typename State, typename X>
|
6
|
-
constexpr result<State, X> operator()(State, X) const
|
7
|
-
{ return {}; }
|
8
|
-
} f{};
|
9
|
-
|
10
|
-
<%= (0...breadth).map { |breadth|
|
11
|
-
xs = (0...depth).map { |depth| "x#{breadth}<#{depth}>" }
|
12
|
-
<<-EOS
|
13
|
-
constexpr struct { } state#{breadth}{};
|
14
|
-
template <int> struct x#{breadth} { };
|
15
|
-
static const auto go#{breadth} = #{yield 'f', "state#{breadth}", xs};
|
16
|
-
EOS
|
17
|
-
}.join("\n") %>
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<%= Benchcc::Fusion::Vector.new(0...depth).includes %>
|
2
|
-
|
3
|
-
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
4
|
-
|
5
|
-
|
6
|
-
<%= render('_main.erb') do |f, state, xs|
|
7
|
-
vector = Benchcc::Fusion::Vector.new(xs)
|
8
|
-
"boost::fusion::fold(#{vector}{}, #{state}, #{f})"
|
9
|
-
end %>
|