1<% 2 def self.avg(xs) 3 xs.inject(0, :+) / xs.length 4 end 5 6 def self.amortize(file) 7 # We remove the first one to mitigate cache effects 8 times = time_compilation(file, 6.times) 9 times.shift 10 avg(times.map { |_, t| t }) 11 end 12%> 13 14{ 15 "chart": { 16 "type": "column" 17 }, 18 "legend": { 19 "enabled": false 20 }, 21 "xAxis": { 22 "type": "category" 23 }, 24 "title": { 25 "text": "Including various metaprogramming libraries" 26 }, 27 "plotOptions": { 28 "series": { 29 "borderWidth": 0, 30 "dataLabels": { 31 "enabled": true, 32 "format": "{point.y:.5f}s" 33 } 34 } 35 }, 36 "series": [{ 37 "name": "Include time", 38 "colorByPoint": true, 39 "data": [ 40 { 41 "name": "Baseline (no includes)", 42 "y": <%= amortize('baseline.erb.cpp') %> 43 }, { 44 "name": "Boost.Hana", 45 "y": <%= amortize('hana.erb.cpp') %> 46 } 47 48 <% if cmake_bool("@Boost_FOUND@") %> 49 , { 50 "name": "Boost.MPL", 51 "y": <%= amortize('mpl.erb.cpp') %> 52 }, { 53 "name": "Boost.Fusion", 54 "y": <%= amortize('fusion.erb.cpp') %> 55 } 56 <% end %> 57 58 <% if cmake_bool("@MPL11_FOUND@") %> 59 , { 60 "name": "MPL11", 61 "y": <%= amortize('mpl11.erb.cpp') %> 62 } 63 <% end %> 64 65 <% if cmake_bool("@Meta_FOUND@") %> 66 , { 67 "name": "Meta", 68 "y": <%= amortize('meta.erb.cpp') %> 69 } 70 <% end %> 71 ] 72 }] 73} 74