Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81758 - sandbox/variadic_templates/sandbox/slim/test
From: cppljevans_at_[hidden]
Date: 2012-12-07 09:58:28


Author: cppljevans
Date: 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
New Revision: 81758
URL: http://svn.boost.org/trac/boost/changeset/81758

Log:
tuple_benchmark_run.py:
  1) Changed to python3.1 to allow use of OrderedDict
  2) Added domain_enumerators.indices to allow more
     meaninful names as indices to domain values; hence,
     allowing easier changing order of domain values.
tree_builder.hpp:
  1) Added TREE_BUILDER_TRACE macro to allow indented
     printing of tuple tree. NOTE, this requires:
       http://svn.boost.org/svn/boost/sandbox/variadic_templates/boost/utility/
     and related files.
Other:
  Can't remember.

Text files modified:
   sandbox/variadic_templates/sandbox/slim/test/Makefile | 4
   sandbox/variadic_templates/sandbox/slim/test/RETURN_ENABLE_IF_DEFAULTS.hpp | 11 ----
   sandbox/variadic_templates/sandbox/slim/test/command_guage.py | 10 ++-
   sandbox/variadic_templates/sandbox/slim/test/time_cmd_name_codes.py | 10 ++--
   sandbox/variadic_templates/sandbox/slim/test/tree_builder.hpp | 25 ++++++++++++
   sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.cpp | 75 +++++++++++++++++++++++++++++++++++-
   sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.guage_time._.run.txt | 76 ++-----------------------------------
   sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_domain.py | 67 +++++++++++++++++++-------------
   sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_filt.py | 24 +++++++----
   sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_pickle.py | 8 +--
   sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py | 81 +++++++++++++++++++++++----------------
   sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_tags.py | 2
   sandbox/variadic_templates/sandbox/slim/test/tuple_impl.bcon12_horizontal.hpp | 16 ++++++-
   sandbox/variadic_templates/sandbox/slim/test/tuple_impl.bcon12_vertical.hpp | 21 +++++++--
   14 files changed, 250 insertions(+), 180 deletions(-)

Modified: sandbox/variadic_templates/sandbox/slim/test/Makefile
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/Makefile (original)
+++ sandbox/variadic_templates/sandbox/slim/test/Makefile 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -1,6 +1,6 @@
 BENCHMARK.suffix=mini
 BENCHMARK.suffix=tree_builder
-GUAGE=guage_time #how to measure the performance (python class in compiler_guage.py)
+GUAGE=guage_time #how to measure the performance (python class in command_guage.py)
 
 TIMEFMT:=%Y%m%d_%H%M%S_%N
 TIMEVAL:=$(shell date +$(TIMEFMT))
@@ -26,7 +26,7 @@
 
 %.$(OUT_SUFFIX).$(RUN_EXT): %.$(SRC_EXT) $(DOM_PY) $(RUN_PY)
         #runs compiler on $<, recording preformance in $@
- $(PYTHON) tuple_benchmark_run.py $(BENCHMARK.suffix) $(RUN_ID) $(GUAGE)
+ -python3.1 tuple_benchmark_run.py $(BENCHMARK.suffix) $(RUN_ID) $(GUAGE)
 
 .PHONY: domain
 domain: #prints the domains(inputs) used in $(RUN_FILENAME) target.

Modified: sandbox/variadic_templates/sandbox/slim/test/RETURN_ENABLE_IF_DEFAULTS.hpp
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/RETURN_ENABLE_IF_DEFAULTS.hpp (original)
+++ sandbox/variadic_templates/sandbox/slim/test/RETURN_ENABLE_IF_DEFAULTS.hpp 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -9,19 +9,10 @@
 // To enable reuse in other code using #include's.
 //
 //=====================================================
-#include <type_traits>
-
 // C++11 eliminates the need for macros! Oh, wait ...
 #define RETURN(...) -> decltype(__VA_ARGS__) { return __VA_ARGS__; }
 
-namespace detail_enable_if
-{
- extern void* enabler;//only used in ENABLE_IF macro.
-}
-
-// New-style enable_if from Matt Calabrese
-#define ENABLE_IF(...) typename std::enable_if<(__VA_ARGS__)>::type *& = detail_enable_if::enabler
-
+#include "./ENABLE_IF.hpp"
 #include "./DEFAULTS.hpp"
 
 #endif

Modified: sandbox/variadic_templates/sandbox/slim/test/command_guage.py
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/command_guage.py (original)
+++ sandbox/variadic_templates/sandbox/slim/test/command_guage.py 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -28,6 +28,7 @@
         pass
 
 import time_cmd_name_codes
+import functools
 
 class guage_time(guage_abstract):
     """
@@ -36,11 +37,12 @@
 
     def __init__( self, measured=time_cmd_name_codes.lst_names()):
         self.measured=measured
- self.format=reduce\
- ( lambda fmt,name: fmt+name+"["+time_cmd_name_codes.fmtcode(name)+"]"
+ self.format=functools.reduce\
+ ( lambda fmt,name: fmt+" "+time_cmd_name_codes.fmtcode(name)
                     , measured
                     , ""
- )
+ )+"'"#just space delimited values.
+ self.format="'"+self.format[1:]
     def names(self):
         return self.measured
 
@@ -65,7 +67,7 @@
     This, of course, requires the command to take the -ftime-report flag.
     """
 
- def names():
+ def names(self):
         return []
 
     def measure(self, command_exe, command_args, measure_out):

Modified: sandbox/variadic_templates/sandbox/slim/test/time_cmd_name_codes.py
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/time_cmd_name_codes.py (original)
+++ sandbox/variadic_templates/sandbox/slim/test/time_cmd_name_codes.py 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -9,17 +9,17 @@
     ( ('UserTime', ('%U',float))
     , ('SystemTime', ('%S',float))
     , ('ElapsedTime', ('%e',float))
- , ('MajorPageFaults', ('%I',long))
- , ('MaxResidentSetSize', ('%M',long))
- , ('Swaps', ('%W',long))
- , ('ContextSwitches', ('%w',long))
+ , ('MajorPageFaults', ('%I',int))
+ , ('MaxResidentSetSize', ('%M',int))
+ , ('Swaps', ('%W',int))
+ , ('ContextSwitches', ('%w',int))
     )
 
 DICT_NAME_CODE=dict(TUPLE_NAME_CODES)
 
 def lst_names():
     """the names in TUPLE_NAME_CODES"""
- return map(lambda (name,code):name,TUPLE_NAME_CODES)
+ return list(map(lambda name_code:name_code[0],TUPLE_NAME_CODES))
 
 def fmtcode(name):
     """the format code for name"""

Modified: sandbox/variadic_templates/sandbox/slim/test/tree_builder.hpp
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tree_builder.hpp (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tree_builder.hpp 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -12,6 +12,9 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 //
+#ifdef TREE_BUILDER_TRACE
+#include <boost/utility/trace_scope.hpp>
+#endif
 #include "./make_tuple.hpp"
 #include <boost/preprocessor/repetition/enum.hpp>
 
@@ -35,7 +38,19 @@
    */
 {
 };
+#ifdef TREE_BUILDER_TRACE
+ template<int Depth, int Index>
+ std::ostream&
+operator<<
+ ( std::ostream& a_out
+ , node_tag<Depth,Index>const& a_tag
+ )
+ {
+ a_out<<"node_tag<"<<Depth<<", "<<Index<<">";
+ return a_out;
+ }
 
+#endif
   template
   < int Depth
   , int Index
@@ -71,6 +86,11 @@
     static auto make_tree(T &&t)
       -> decltype(tree_builder<Depth+1>::make_tree(::make_tuple(BOOST_PP_ENUM(TUPLE_SIZE, M0, ~))))
     {
+ #ifdef TREE_BUILDER_TRACE
+ boost::trace_scope ts(":tree_builder<Depth>::make_tree.");
+ std::cout<<":Depth="<<Depth<<"\n";
+ std::cout<<":t="<<t<<"\n";
+ #endif
         auto res = tree_builder<Depth+1>::make_tree(::make_tuple(BOOST_PP_ENUM(TUPLE_SIZE, M0, ~)));
         // Get each element of the tuple.
         BOOST_PP_REPEAT(TUPLE_SIZE, M1, ~)
@@ -87,6 +107,11 @@
     template<typename T>
     static T make_tree(T &&t)
     {
+ #ifdef TREE_BUILDER_TRACE
+ boost::trace_scope ts(":tree_builder<TREE_DEPTH>::make_tree.");
+ std::cout<<":TREE_DEPTH="<<TREE_DEPTH<<"\n";
+ std::cout<<":t==res="<<t<<"\n";
+ #endif
         return static_cast<T &&>(t);
     }
 };

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.cpp
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.cpp (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.cpp 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -12,13 +12,80 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 //
 #include "./tree_builder.hpp"
-template<unsigned I>
-struct leaf
-{};
+
+#ifdef TREE_BUILDER_TRACE
+#include "print_tuple_bench.hpp"
+#endif
+
+#ifndef TREE_LEAF_TYPE
+ #define TREE_LEAF_TYPE 0
+#endif
+
+#if TREE_LEAF_TYPE == 0 || TUPLE_TEMPLATED_CTOR == 0
+ template<unsigned I>
+ struct leaf
+ {
+ leaf(unsigned a_i=I)
+ : my_i(a_i)
+ {}
+
+ unsigned my_i;
+ };
+ #ifdef TREE_BUILDER_TRACE
+ template<unsigned I>
+ std::ostream&
+ operator<<
+ ( std::ostream& sout
+ , leaf<I>const& a_leaf
+ )
+ {
+ sout<<"leaf<"<<I<<">("<<a_leaf.my_i<<")";
+ return sout;
+ }
+ #endif
+ auto
+ make_leaf()
+ -> decltype(::make_tuple(leaf<100>(),leaf<101>(),leaf<102>()))
+ {
+ return ::make_tuple(leaf<100>(),leaf<101>(),leaf<102>());
+ }
+#else
+ //This make_leaf produces the "leaf" structure used in the original
+ //tree_builder driver(The one mentioned in 2012-10-25.1521 CST
+ //ChangeLog above).
+ //
+ char sz[] = "hello";
+ typedef
+ decltype(sz)
+ tuple_elem1_raw_t
+ ;
+ typedef
+ tuple_elem1_raw_t&
+ tuple_elem1_t
+ ;
+ tuple_bench
+ < int
+ , tuple_elem1_t
+ >
+ x
+ ( 1
+ , std::ref(sz)
+ )
+ ;
+ auto
+ make_leaf()
+ -> decltype(::make_tuple(1, "hello", 3.14, 'a', x))
+ {
+ return ::make_tuple(1, "hello", 3.14, 'a', x);
+ }
+#endif
 
 int main()
 {
- auto y = tree_builder<1>::make_tree(::make_tuple(leaf<100>(),leaf<101>(),leaf<102>()));
+#ifdef TREE_BUILDER_TRACE
+ boost::iostreams::indent_scoped_ostreambuf<char> indent_outbuf(std::cout,indent_by);
+#endif
+ auto y = tree_builder<0>::make_tree(make_leaf());
     return 0;
 }
 

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.guage_time._.run.txt
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.guage_time._.run.txt (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.guage_time._.run.txt 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -1,14 +1,4 @@
 compilers[
-compiler_name: gcc4_8
-version[
-Using built-in specs.
-COLLECT_GCC=/home/evansl/download/gcc/4.8-20121028/install/bin/g++
-COLLECT_LTO_WRAPPER=/home/evansl/download/gcc/4.8-20121028/install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
-Target: x86_64-unknown-linux-gnu
-Configured with: /home/evansl/download/gcc/4.8-20121028/build/../src/configure --prefix=/home/evansl/download/gcc/4.8-20121028/build/../install --enable-languages=c++ --enable-checking=release
-Thread model: posix
-gcc version 4.8.0 20121028 (experimental) (GCC)
-]version
 compiler_name: clangxx
 version[
 clang version 3.2 (trunk 165317)
@@ -17,69 +7,13 @@
 compiler_exe: /home/evansl/download/llvm/svn/build/Release/bin/clang
 ]version
 ]compilers
-domain_names['compiler', 'TUPLE_IMPL', 'TUPLE_SIZE', 'TUPLE_UNROLL_MAX', 'TREE_DEPTH', 'TUPLE_TEMPLATED_CTOR']domain_names
+domain_names['iter', 'compiler', 'TUPLE_IMPL', 'TUPLE_SIZE', 'TUPLE_UNROLL_MAX', 'TREE_DEPTH', 'TUPLE_TEMPLATED_CTOR']domain_names
 range_how['guage_time', 'UserTime', 'SystemTime', 'ElapsedTime', 'MajorPageFaults', 'MaxResidentSetSize', 'Swaps', 'ContextSwitches']range_how
-domain_values['gcc4_8', 'bcon12_horizontal', 15, -1, 4, 0]domain_values
-range_out[
-UserTime[0.81]SystemTime[0.09]ElapsedTime[0.89]MajorPageFaults[0]MaxResidentSetSize[221744]Swaps[0]ContextSwitches[5]
-]range_out
-domain_values['gcc4_8', 'bcon12_horizontal', 15, -1, 4, 1]domain_values
-range_out[
-UserTime[1.01]SystemTime[0.12]ElapsedTime[1.10]MajorPageFaults[0]MaxResidentSetSize[222000]Swaps[0]ContextSwitches[5]
-]range_out
-domain_values['gcc4_8', 'bcon12_horizontal', 15, -1, 5, 0]domain_values
-range_out[
-UserTime[3.76]SystemTime[0.41]ElapsedTime[4.15]MajorPageFaults[0]MaxResidentSetSize[1240656]Swaps[0]ContextSwitches[5]
-]range_out
-domain_values['gcc4_8', 'bcon12_horizontal', 15, -1, 5, 1]domain_values
-range_out[
-UserTime[1.82]SystemTime[0.13]ElapsedTime[1.93]MajorPageFaults[0]MaxResidentSetSize[271136]Swaps[0]ContextSwitches[5]
-]range_out
-domain_values['gcc4_8', 'bcon12_vertical', 15, 10, 4, 0]domain_values
-range_out[
-UserTime[0.68]SystemTime[0.08]ElapsedTime[0.74]MajorPageFaults[0]MaxResidentSetSize[190688]Swaps[0]ContextSwitches[5]
-]range_out
-domain_values['gcc4_8', 'bcon12_vertical', 15, 10, 4, 1]domain_values
-range_out[
-UserTime[0.78]SystemTime[0.04]ElapsedTime[0.81]MajorPageFaults[0]MaxResidentSetSize[187776]Swaps[0]ContextSwitches[5]
-]range_out
-domain_values['gcc4_8', 'bcon12_vertical', 15, 10, 5, 0]domain_values
-range_out[
-UserTime[1.41]SystemTime[0.08]ElapsedTime[1.49]MajorPageFaults[0]MaxResidentSetSize[418768]Swaps[0]ContextSwitches[8]
-]range_out
-domain_values['gcc4_8', 'bcon12_vertical', 15, 10, 5, 1]domain_values
-range_out[
-UserTime[0.98]SystemTime[0.12]ElapsedTime[1.11]MajorPageFaults[8]MaxResidentSetSize[208464]Swaps[0]ContextSwitches[5]
-]range_out
-domain_values['clangxx', 'bcon12_horizontal', 15, -1, 4, 0]domain_values
-range_out[
-UserTime[0.44]SystemTime[0.05]ElapsedTime[0.48]MajorPageFaults[0]MaxResidentSetSize[119440]Swaps[0]ContextSwitches[3]
-]range_out
-domain_values['clangxx', 'bcon12_horizontal', 15, -1, 4, 1]domain_values
-range_out[
-UserTime[0.65]SystemTime[0.04]ElapsedTime[0.68]MajorPageFaults[0]MaxResidentSetSize[144160]Swaps[0]ContextSwitches[3]
-]range_out
-domain_values['clangxx', 'bcon12_horizontal', 15, -1, 5, 0]domain_values
-range_out[
-UserTime[0.61]SystemTime[0.07]ElapsedTime[0.67]MajorPageFaults[0]MaxResidentSetSize[131520]Swaps[0]ContextSwitches[3]
-]range_out
-domain_values['clangxx', 'bcon12_horizontal', 15, -1, 5, 1]domain_values
-range_out[
-UserTime[1.27]SystemTime[0.09]ElapsedTime[1.35]MajorPageFaults[0]MaxResidentSetSize[168912]Swaps[0]ContextSwitches[3]
-]range_out
-domain_values['clangxx', 'bcon12_vertical', 15, 10, 4, 0]domain_values
-range_out[
-UserTime[5.89]SystemTime[0.05]ElapsedTime[5.93]MajorPageFaults[0]MaxResidentSetSize[125728]Swaps[0]ContextSwitches[3]
-]range_out
-domain_values['clangxx', 'bcon12_vertical', 15, 10, 4, 1]domain_values
-range_out[
-UserTime[6.78]SystemTime[0.04]ElapsedTime[6.81]MajorPageFaults[0]MaxResidentSetSize[133920]Swaps[0]ContextSwitches[3]
-]range_out
-domain_values['clangxx', 'bcon12_vertical', 15, 10, 5, 0]domain_values
+domain_values[0, 'clangxx', 'bcon12_horizontal', 10, -1, 2, 1]domain_values
 range_out[
-UserTime[93.41]SystemTime[0.30]ElapsedTime[93.70]MajorPageFaults[0]MaxResidentSetSize[180112]Swaps[0]ContextSwitches[3]
+0.38 0.05 0.42 0 111616 0 3
 ]range_out
-domain_values['clangxx', 'bcon12_vertical', 15, 10, 5, 1]domain_values
+domain_values[0, 'clangxx', 'bcon12_horizontal', 10, -1, 3, 1]domain_values
 range_out[
-UserTime[90.21]SystemTime[0.42]ElapsedTime[90.62]MajorPageFaults[0]MaxResidentSetSize[173712]Swaps[0]ContextSwitches[3]
+0.51 0.03 0.53 0 124944 0 3
 ]range_out

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_domain.py
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_domain.py (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_domain.py 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -6,83 +6,94 @@
 # 1) the particular compilers used to compile the benchmark.
 # 2) the values of various macros used in the source code.
 #
+from __future__ import print_function
 from product_dep import product_dep
 
+class domain_enumerators:
+ indices=None
+ #Above will be named indices to the domains.(set elsewhere).
+
 class compilers(object):
+ """compiler abbreviations"""
   def __init__(self, names):
     self.names=names
   def __call__(self,xs):
     return self.names
 
 class impls(object):
- "tuple implementations"
+ """TUPLE_IMPL macro values(which are tuple implementation abbreviations)."""
   def __init__(self, names):
     self.names=names
   def __call__(self,xs):
     return self.names
 
 class sizes(object):
- "TUPLE_SIZE macro values"
+ """TUPLE_SIZE macro values."""
   def __init__(self, tuple_sizes):
     self.sizes=tuple_sizes
   def __call__(self,xs):
     return self.sizes
 
-class last(object):
- "LAST_LESS macro values. Only used in mini benchmark."
+class lasts(object):
+ """LAST_LESS macro values(Only used in mini benchmark)."""
   def __init__(self, size_start, size_step=1):
     self.start=size_start
     self.step=size_step
   def __call__(self,xs):
     return range(
         self.start
- , self.start+1#xs[2]+1 #xs[2] is current tuple_size
+ , self.start+1
       , self.step
       )
 
-class unroll_max(object):
- "TUPLE_UNROLL_MAX macro values(only used with vertical impl)"
- def __init__(self, size_start=2, size_step=4):
+class unroll_maxs(object):
+ """TUPLE_UNROLL_MAX macro values(only used with vertical impl)"""
+ def __init__(self, size_start=2, size_step=4,):
     self.start=size_start
     self.step=size_step
   def __call__(self,xs):
- if ((xs[1] == 'vertical') or (xs[1] == 'bcon12_vertical')):
+ impl_ndx=domain_enumerators.indices.TUPLE_IMPL
+ if ((xs[impl_ndx] == 'vertical') or (xs[impl_ndx] == 'bcon12_vertical')):
       if False:
+ size_ndx=domain_enumerators.indices.TUPLE_SIZE
         return range(
- xs[2]#self.start
- , xs[2]+1+self.step #xs[2] is current tuple_size
+ xs[size_ndx]
+ , xs[size_ndx]+1+self.step
           , self.step
           )
       else:
         return [10]
     return [-1]
 
-class tree_depth(object):
- "TREE_DEPTH macro values(only used in tree_builder benchmark)"
- def __init__(self, depth_start=2, depth_finish=4, depth_step=1):
+class tree_depths(object):
+ """TREE_DEPTH macro values(only used in tree_builder benchmark)"""
+ def __init__(self, depth_start=2, depth_finish_plus_1=4, depth_step=1):
     self.start=depth_start
- self.finish=depth_finish
+ self.finish_plus_1=depth_finish_plus_1
     self.step=depth_step
   def __call__(self,xs):
     if True:
- return range(
- self.start
- , self.finish+1
- , self.step
- )
+ ndx=domain_enumerators.indices
+ result = range(self.start, self.finish_plus_1, self.step)
+ if ( xs[ndx.compiler ] == 'clangxx'
+ and xs[ndx.TUPLE_IMPL] == 'bcon12_vertical'
+ and xs[ndx.TUPLE_SIZE] > 10
+ ):#Otherwise, clangxx takes way too long.
+ result = range(self.start-1, self.finish_plus_1-1, self.step)
+ return result
     else:
       return [2]
 
-class templated_ctor_flag(object):
- "TUPLE_TEMPLATED_CTOR macro values(only used in tree_builder benchmark)"
- def __init__(self, start=0, finish=1):
+class templated_ctor_flags(object):
+ """TUPLE_TEMPLATED_CTOR macro values(only used in tree_builder benchmark)"""
+ def __init__(self, start=0, finish_plus_1=2):
     self.start=max(0,start)
- self.finish=min(finish,1)
+ self.finish_plus_1=min(finish_plus_1,2)
   def __call__(self,xs):
     if True:
       return range(
           self.start
- , self.finish+1
+ , self.finish_plus_1
         , 1
         )
     else:
@@ -96,9 +107,9 @@
     [ compilers(["compiler1","compiler2"])
     , impls(["impl1","vertical"])
     , sizes(range(tuple_min_size,tuple_max_size+1,tuple_del_size))
- , last(tuple_min_size,tuple_del_size)
- , unroll_max()
- , templated_ctor_flag()
+ , lasts(tuple_min_size,tuple_del_size)
+ , unroll_maxs()
+ , templated_ctor_flags()
     ])
   for element in domain():
       print(element)

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_filt.py
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_filt.py (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_filt.py 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -6,6 +6,7 @@
 from __future__ import print_function
 import sys, pickle
 from collections import namedtuple
+from enums import enumeration
 from print_domain_range import print_domain_range
 
 def main(argv):
@@ -20,23 +21,28 @@
   print(":range_names_lst=",range_names_lst)
   #print(":domain_range_values=")
   #print_domain_range(domain_range_values)
- domain_names_type=namedtuple('domain_names_indices',domain_names_lst)
- d_ndx=domain_names_type._make(range(len(domain_names_lst)))
- #print("domain_indices=",d_ndx)
+ d_ndx=enumeration(domain_names_lst).enumerators()
+ print("domain_indices=",d_ndx)
+ filt_fun=lambda (d_lst,r_lst)\
+ : True
   filt_dr=filter\
- ( lambda (d_lst,r_lst)
- : d_lst[d_ndx.TREE_DEPTH] == 5
+ ( filt_fun
     , domain_range_values
     )
   if False:
     print(":filt_dr=")
     print_domain_range(filt_dr)
+ sort_fun=lambda (d_lst,r_lst)\
+ : ( d_lst[d_ndx.TUPLE_SIZE]
+ , d_lst[d_ndx.TREE_DEPTH]
+ , d_lst[d_ndx.TUPLE_TEMPLATED_CTOR]
+ , d_lst[d_ndx.iter]
+ , d_lst[d_ndx.TUPLE_IMPL]
+ , d_lst[d_ndx.compiler]
+ )
   sort_dr=sorted\
     ( filt_dr
- , key=lambda (d_lst,r_lst)
- : ( d_lst[d_ndx.compiler]
- , d_lst[d_ndx.TUPLE_TEMPLATED_CTOR]
- )
+ , key=sort_fun
     )
   if True:
     print(":sort_dr=")

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_pickle.py
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_pickle.py (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_pickle.py 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -37,19 +37,17 @@
 
     def __init__(self,names):
         self.range_names=names
- range_values_pat=reduce(lambda pat,name: pat+name+"\[(.*)\]",names,"^")+"$"
- self.range_values_re=re.compile(range_values_pat)
 
     def names(self):
         return self.range_names
 
     def parse(self,range_values_str):
- found=self.range_values_re.search(range_values_str)
- range_values_lst=[]
+ range_values_lst=range_values_str.split()
         #print(":range_names=",self.range_names)
+ #print(":range_values_lst=",range_values_lst)
         n=len(self.range_names)
         for i in range(n):
- str_val=found.group(i+1)
+ str_val=range_values_lst[i]
             #print(":i=",i,":str_val=",str_val)
             range_val=time_cmd_name_codes.convert_str(self.range_names[i],str_val)
             range_values_lst.append(range_val)

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -1,10 +1,12 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3.1
 """
 Run compilers on programs while recording resources usage.
 """
-from __future__ import print_function
+#from __future__ import print_function
 import sys
 import subprocess
+import collections
+import functools
 
 from tuple_benchmark_domain import *
 from compiler_map import COMPILER_MAP
@@ -36,6 +38,34 @@
     ""\
   #
 
+def domain_defs(benchmark_suffix):
+ """defines domains used in benchmark"""
+ compiler_domain=['clangxx']
+ niter=1#number of iterations to run with same values for other domains.
+ impl_domain=\
+ [ 'bcon12_horizontal'
+ #, 'bcon12_vertical'
+ ]
+ tuple_size_domain_del=5
+ tuple_sizes_domain=range(10,11,tuple_size_domain_del)
+ name_domain=collections.OrderedDict\
+ ( ( ('iter', lambda ignore:range(niter))
+ , ('compiler', compilers(compiler_domain))
+ , ('TUPLE_IMPL', impls(impl_domain))
+ , ('TUPLE_SIZE', sizes(tuple_sizes_domain))
+ , ('TUPLE_UNROLL_MAX', unroll_maxs())
+ )
+ )
+ if benchmark_suffix == "mini" :
+ name_domain['LAST_LESS']=lasts(4,tuple_size_domain_del)
+ else:
+ name_domain['TREE_DEPTH']=tree_depths(2,4,1)
+ name_domain['TUPLE_TEMPLATED_CTOR']=templated_ctor_flags(1,2)
+ domain_names=name_domain.keys()
+ indices_type=collections.namedtuple('domain_indices',domain_names)
+ domain_enumerators.indices=indices_type._make(range(len(domain_names)))
+ return name_domain
+
 def main(argv):
   """
   Inputs:
@@ -51,7 +81,6 @@
   result = None
   #set defaults for argv[1..3]
   benchmark_suffix="mini"
- guage_name="guage_time"
   benchmark_run="_"
   #print("argv=",argv)
   iarg=1
@@ -65,45 +94,28 @@
     guage_spec=argv[iarg:]
   src_filename=tuple_benchmark_filenames.src_filename(benchmark_suffix)
   #print("src_filename=",src_filename)
- #[Define Domains.
- compiler_domain=['gcc4_8','clangxx']
- impl_domain=['bcon12_horizontal','bcon12_vertical']
- tuple_size_domain_min=15
- tuple_size_domain_max=15
- tuple_size_domain_del=5
- name_domain=[
- [ 'compiler', compilers(compiler_domain)]
- , [ 'TUPLE_IMPL', impls(impl_domain)]
- , [ 'TUPLE_SIZE', sizes(range(tuple_size_domain_min,tuple_size_domain_max+1,tuple_size_domain_del))]
- , [ 'TUPLE_UNROLL_MAX', unroll_max()]
- ]
- if benchmark_suffix == "mini" :
- name_domain.append( [ 'LAST_LESS', last(4,tuple_size_domain_del)])
- else:
- name_domain.append( [ 'TREE_DEPTH', tree_depth(4,5,1)])
- name_domain.append( [ 'TUPLE_TEMPLATED_CTOR', templated_ctor_flag(0,1)])
- #]Define Domains.
- domains=product_dep(
- map(lambda t: t[1], name_domain)
- )
+ name_domain=domain_defs(benchmark_suffix)
+ domain_names=list(name_domain.keys())
+ domain_values=product_dep(name_domain.values())
   guage_class='command_guage.'+guage_spec[0]
- guage_args=reduce(lambda args,arg:args+", "+arg, guage_spec[1:], "")
+ guage_args=functools.reduce(lambda args,arg:args+", "+arg, guage_spec[1:], "")
   guage_args='('+guage_args[1:]+')'
- guage_eval=guage_class+guage_args
- guage_obj=eval(guage_eval)
+ guage_code=guage_class+guage_args
+ guage_obj=eval(guage_code)
   guage_how=[guage_spec[0]]+guage_obj.names()
   run_fileobj=\
     open\
     ( tuple_benchmark_filenames.out_filename\
       ( 'run'
       , benchmark_suffix
- , guage_name
+ , guage_spec[0]
       , benchmark_run
       )
     , mode='w'
     )
   print(TAG_TUPLE.compilers+"[",file=run_fileobj)
- for compiler_name in COMPILER_MAP.keys():
+ compiler_domain=name_domain['compiler']
+ for compiler_name in compiler_domain.names:
     (compiler_exe,compiler_flags)=COMPILER_MAP[compiler_name]
     print("compiler_name:",compiler_name,file=run_fileobj)
     print(TAG_TUPLE.version+"[",file=run_fileobj)
@@ -118,17 +130,20 @@
       print("compiler_exe:",compiler_exe,file=run_fileobj)
     print("]"+TAG_TUPLE.version,file=run_fileobj)
   print("]"+TAG_TUPLE.compilers,file=run_fileobj)
- domain_names=list(map(lambda t:t[0],name_domain))
   print(TAG_TUPLE.domain_names
     , domain_names,sep="", end=TAG_TUPLE.domain_names+"\n"
     , file=run_fileobj)
   print(TAG_TUPLE.range_how,guage_how,TAG_TUPLE.range_how,sep="",file=run_fileobj)
- macro_names=domain_names[1:]
- for element in domains():
+ macros_index=2
+ macro_names=domain_names[macros_index:]
+ for element in domain_values():
       print(TAG_TUPLE.domain_values
         , element, sep="", end=TAG_TUPLE.domain_values+"\n"
         , file=run_fileobj)
- compiler_name, macro_vals=element[0], element[1:]
+ print(TAG_TUPLE.domain_values
+ , element, sep="", end=TAG_TUPLE.domain_values+"\n"
+ )
+ compiler_name, macro_vals=element[macros_index-1], element[macros_index:]
       #print(":compiler_name=",compiler_name,":macro_vals=",macro_vals)
       compiler_macros=""
       for name,value in zip(macro_names,macro_vals):

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_tags.py
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_tags.py (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_tags.py 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -17,4 +17,4 @@
 TAG_TUPLE=tag_tuple._make(tag_names)
 
 if __name__ == '__main__':
- print TAG_TUPLE
+ print(TAG_TUPLE)

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple_impl.bcon12_horizontal.hpp
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple_impl.bcon12_horizontal.hpp (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple_impl.bcon12_horizontal.hpp 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -14,7 +14,11 @@
 
 #include "./make_indexes.hpp"
 
-#include "./RETURN_ENABLE_IF_DEFAULTS.hpp"
+#if TUPLE_TEMPLATED_CTOR == 1
+ #include "./RETURN_ENABLE_IF_DEFAULTS.hpp"
+#else
+ #include "./ENABLE_IF.hpp"
+#endif
 
 namespace detail
 {
@@ -23,7 +27,13 @@
     template<int I, typename T>
     struct tuple_elem
     {
+ #if TUPLE_TEMPLATED_CTOR == 1
         DEFAULTS(tuple_elem)
+ #else
+ //This #else code allows default CTOR if T not default constructable.
+ static T our_value;
+ tuple_elem():value(our_value){}
+ #endif
 
         template<typename U
           , ENABLE_IF(!std::is_same<U, tuple_elem &>::value)>
@@ -45,9 +55,9 @@
         // can't seem to expand two packs in lock step with unrolling. Huh.
       : tuple_elem<0, H>, tuple_elem<Ints, T>...
     {
+ #if TUPLE_TEMPLATED_CTOR == 1
         DEFAULTS(tuple_impl)
 
- #if TUPLE_TEMPLATED_CTOR == 1
         template<typename U, typename ...V
           , ENABLE_IF(sizeof...(V) != 0 || !std::is_same<U, tuple_impl &>::value)>
         explicit constexpr tuple_impl(U &&u, V &&...v) // HACK around gcc bug #53036
@@ -98,9 +108,9 @@
     , T...
>
 {
+ #if TUPLE_TEMPLATED_CTOR == 1
     DEFAULTS(tuple_bench)
   
- #if TUPLE_TEMPLATED_CTOR == 1
         typedef
       detail::tuple_impl
       < typename detail::make_indexes<sizeof...(T)+1>::type

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple_impl.bcon12_vertical.hpp
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple_impl.bcon12_vertical.hpp (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple_impl.bcon12_vertical.hpp 2012-12-07 09:58:26 EST (Fri, 07 Dec 2012)
@@ -49,10 +49,8 @@
 #define INIT(Z, N, D) t ## N(static_cast< U ## N && >( u ## N ))
 #define MEMBERS(Z, N, D) T ## N t ## N;
 
-#define BOOST_PP_LOCAL_MACRO(N) \
-template<BOOST_PP_ENUM_PARAMS(N, typename T)> \
-struct tuple_bench<BOOST_PP_ENUM_PARAMS(N, T)> \
-{ \
+#if TUPLE_TEMPLATED_CTOR == 1
+ #define TEMPLATED_TUPLE_CTOR_GEN(N) \
     DEFAULTS(tuple_bench) \
                                                                     \
     template<BOOST_PP_ENUM_PARAMS(N, typename U) \
@@ -62,6 +60,16 @@
       : BOOST_PP_ENUM(N, INIT, ~) \
     {} \
                                                                     \
+ /**/
+#else
+ #define TEMPLATED_TUPLE_CTOR_GEN(N)
+#endif
+
+#define BOOST_PP_LOCAL_MACRO(N) \
+template<BOOST_PP_ENUM_PARAMS(N, typename T)> \
+struct tuple_bench<BOOST_PP_ENUM_PARAMS(N, T)> \
+{ \
+ TEMPLATED_TUPLE_CTOR_GEN(N) \
     BOOST_PP_REPEAT(N, MEMBERS, ~) \
 }; \
 /**/
@@ -69,10 +77,13 @@
 #define BOOST_PP_LOCAL_LIMITS (1, TUPLE_UNROLL_MAX)
 #include BOOST_PP_LOCAL_ITERATE()
 
+#undef TEMPLATED_TUPLE_CTOR_GEN
+
 // A tuple type that can be statically initialized
 template<BOOST_PP_ENUM_PARAMS(TUPLE_UNROLL_MAX, typename T), typename ...Tail>
 struct tuple_bench<BOOST_PP_ENUM_PARAMS(TUPLE_UNROLL_MAX, T), Tail...>
 {
+ #if TUPLE_TEMPLATED_CTOR == 1
     DEFAULTS(tuple_bench)
 
     // Not explicit to allow things like: return {42, "allo"};.
@@ -84,6 +95,7 @@
       : BOOST_PP_ENUM(TUPLE_UNROLL_MAX, INIT, ~)
       , tail(static_cast<Rest &&>(rest)...) // std::forward is NOT constexpr!
     {}
+ #endif
 
     BOOST_PP_REPEAT(TUPLE_UNROLL_MAX, MEMBERS, ~)
     tuple_bench<Tail...> tail;
@@ -91,7 +103,6 @@
 
 #undef INIT
 #undef MEMBERS
-#undef DEFAULTS
 
 namespace detail
 {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk