Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60367 - in sandbox/statistics/detail/assign: boost/assign/auto_size/array boost/assign/auto_size/detail libs/assign/doc libs/assign/example
From: erwann.rogard_at_[hidden]
Date: 2010-03-08 14:44:52


Author: e_r
Date: 2010-03-08 14:44:50 EST (Mon, 08 Mar 2010)
New Revision: 60367
URL: http://svn.boost.org/trac/boost/changeset/60367

Log:
m
Text files modified:
   sandbox/statistics/detail/assign/boost/assign/auto_size/array/lazy.hpp | 15 +++++----------
   sandbox/statistics/detail/assign/boost/assign/auto_size/array/static.hpp | 18 ++++++------------
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/csv.hpp | 10 +++++++---
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy.hpp | 7 +++++++
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/types.hpp | 4 ++--
   sandbox/statistics/detail/assign/libs/assign/doc/speed2.txt | 30 +++++++++++++++---------------
   sandbox/statistics/detail/assign/libs/assign/example/ref_list_of.cpp | 3 ---
   7 files changed, 42 insertions(+), 45 deletions(-)

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/array/lazy.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/array/lazy.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/array/lazy.hpp 2010-03-08 14:44:50 EST (Mon, 08 Mar 2010)
@@ -12,21 +12,13 @@
 #include <boost/assign/auto_size/array/interface.hpp>
 #include <boost/assign/auto_size/array/ref.hpp>
 #include <boost/assign/auto_size/detail/policy.hpp>
+#include <boost/assign/auto_size/array/tag.hpp>
 
 namespace boost{
 namespace assign{
 namespace detail{
 namespace auto_size{
 
- // tag::lazy_array designates a policy for auto_size::expr<>, that has the
- // functionality of array_interface<>, and postones allocation until it is
- // necessary. It is therefore suitable as the result of statements such as:
- // fun(a)(b)(c);
-
- namespace tag{
- struct lazy_array{};
- }
-
     template<typename T,int N,template<typename> class R,typename D>
     class lazy_array;
 
@@ -34,7 +26,7 @@
     template<typename E> struct expr_elem;
 
     template<>
- struct policy<tag::lazy_array>
+ struct policy<tag::array>
     {
         template<typename E,template<typename> class R>
         struct apply{
@@ -52,6 +44,9 @@
             template<typename> class R,typename P,bool F>
     void write_to_array(A& a,const expr<E,T,N,R,P,F>& e);
                   
+ // lazy_array is a suitable policy for auto_size::expr<>, that has the
+ // functionality of array_interface<>, and postones allocation until it is
+ // necessary.
    template<typename T,int N,template<typename> class R,typename D>
    class lazy_array
             : public array_interface<T,N,R,lazy_array<T,N,R,D> >

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/array/static.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/array/static.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/array/static.hpp 2010-03-08 14:44:50 EST (Mon, 08 Mar 2010)
@@ -11,29 +11,23 @@
 #include <boost/assign/auto_size/array/interface.hpp>
 #include <boost/assign/auto_size/array/ref.hpp>
 #include <boost/assign/auto_size/detail/expr.hpp> // needed for write_to_array
+#include <boost/assign/auto_size/array/tag.hpp>
 
 namespace boost{
 namespace assign{
 namespace detail{
 namespace auto_size{
  
- namespace tag{
- struct static_array{};
- }
  
- // tag::static_array designates a data-structure that has the functonality
- // of array_interface<> and is allocated at construction. It is recommended
- // as the result of functions that have the csv form :
- // fun(a,b,c)
- // Unlike lazy_array, it is not a suitable policy for auto_size::expr<>.
- // This is desirable as otherwise the result from fun(a,b,c) would be much
- // costlier to construct (this has already been tested).
-
+ // static_array has the functionality of of array_interface<> and is
+ // allocated at construction. It is suitable as the result from a csv
+ // function.
+
     template<typename T,int N,template<typename> class R>
     class static_array;
 
     template<>
- struct policy<tag::static_array>
+ struct csv_policy<tag::array>
     {
         template<typename T,int N,template<typename> class R>
         struct apply{

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/csv.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/detail/csv.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/csv.hpp 2010-03-08 14:44:50 EST (Mon, 08 Mar 2010)
@@ -18,8 +18,7 @@
 
 // Whereas adjacent unary function calls is the usual way to create a collec-
 // tion in Boost.Assign, this macro provides, as an alternative, functions that
-// are overloaded on the number of arguments. The result, by default, is a
-// static array; in particular, it cannot be grown further.
+// are overloaded on the number of arguments.
 //
 // Let n = BOOST_ASSIGN_CSV_SIZE and a1,...,an, objects of type T, Ref an alias
 // for BOOST_ASSIGN_CSV_ref, P0 = BOOST_ASSIGN_CSV_DEF_POLICY and r<U,N,P> an
@@ -32,6 +31,11 @@
 // cfun<P>(a1,..,.ai) r<const T,i,P>
 // fun(a1,..,.ai) r<T,i,P0>
 // cfun(a1,..,.ai) r<const T,i,P0>
+//
+// Note : for performance, it is critical that the collection builder,
+// auto_size::expr<> be used only during construction of the result, not as
+// part of the result itself. In designing a custom policy, look first at how
+// the default hanldes this.
 
 #ifndef BOOST_ASSIGN_CSV_SIZE
 #define BOOST_ASSIGN_CSV_SIZE 20
@@ -41,7 +45,7 @@
 #error
 #endif
 #define BOOST_ASSIGN_CSV_DEF_POLICY \
- boost::assign::detail::auto_size::tag::static_array \
+ boost::assign::detail::auto_size::tag::array \
 /**/
 #define BOOST_ASSIGN_CSV_RESULT(U,N,P) \
     typename boost::assign::detail::auto_size::policy<P>::template \

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/policy.hpp 2010-03-08 14:44:50 EST (Mon, 08 Mar 2010)
@@ -24,6 +24,10 @@
             typedef Tag tag;
     };
 
+ template<typename Tag>
+ struct csv_policy{
+ typedef Tag tag;
+ };
 
     template<>
         struct policy<tag::no_policy>{
@@ -33,6 +37,9 @@
             };
     };
 
+ template<>
+ struct csv_policy<tag::no_policy>
+ : policy<tag::no_policy>{};
     
 }// auto_size
 }// detail

Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/types.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/detail/types.hpp (original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/types.hpp 2010-03-08 14:44:50 EST (Mon, 08 Mar 2010)
@@ -10,6 +10,7 @@
 #define BOOST_ASSIGN_DETAIL_AUTO_SIZE_TYPES_ER_2010_HPP
 #include <boost/mpl/void.hpp>
 #include <boost/mpl/bool.hpp>
+#include <boost/assign/auto_size/array/tag.hpp>
 
 namespace boost{
 namespace assign{
@@ -18,11 +19,10 @@
 
     namespace tag{
         struct no_policy;
- struct lazy_array;
     }
 
     typedef boost::mpl::void_ top_;
- typedef tag::lazy_array default_policy;
+ typedef tag::array default_policy;
     typedef tag::no_policy no_policy;
     typedef boost::mpl::bool_<false> false_;
     typedef boost::mpl::bool_<true> true_;

Modified: sandbox/statistics/detail/assign/libs/assign/doc/speed2.txt
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/doc/speed2.txt (original)
+++ sandbox/statistics/detail/assign/libs/assign/doc/speed2.txt 2010-03-08 14:44:50 EST (Mon, 08 Mar 2010)
@@ -6,27 +6,27 @@
 
 Mac OS Leopard 10.6 - x86_64 - Release mode - gcc 4.2
 cref_list_of(1) => 0.15 s
-cref_csv(1) => 0.33 s
+cref_csv(1) => 0.33 s
 cref_list_of<>(1) => 0.00 s
 list_of(1) => 131.03 s
 
 cref_list_of(3) => 0.54 s
-cref_csv(3) => 1.45 s
+cref_csv(3) => 1.45 s
 cref_list_of<>(3) => 0.37 s
 list_of(3) => 342.12 s
 
 cref_list_of(10) => 2.01 s
-cref_csv(10) => 3.53 s
+cref_csv(10) => 3.53 s
 cref_list_of<>(10) => 1.05 s
 list_of(10) => 878.79 s
 
 cref_list_of(30) => 7.15 s
-cref_csv(30) => 9.63 s
+cref_csv(30) => 9.63 s
 cref_list_of<>(30) => 4.16 s
 list_of(30) => 2475.13 s
 
 cref_list_of(90) => 25.68 s
-cref_csv(90) => 28.22 s
+cref_csv(90) => 28.22 s
 cref_list_of<>(90) => 7.19 s
 list_of(90) => 7284.27 s
 
@@ -34,53 +34,53 @@
 
 Win7-32 V6.1.7100 - Dev-C++ 5.0 beta 9.2 - Mingw/GCC 3.4.2 - Best optim
 cref_list_of(1) => 0.80 s
-cref_csv(1) => 1.97 s
+cref_csv(1) => 1.97 s
 cref_list_of<>(1) => 0.42 s
 list_of(1) => 371.00 s
 
 cref_list_of(3) => 2.21 s
-cref_csv(3) => 4.25 s
+cref_csv(3) => 4.25 s
 cref_list_of<>(3) => 0.99 s
 list_of(3) => 852.00 s
 
 cref_list_of(10) => 6.51 s
-cref_csv(10) => 11.90 s
+cref_csv(10) => 11.90 s
 cref_list_of<>(10) => 3.92 s
 list_of(10) => 931.79 s
 
 cref_list_of(30) => 19.53 s
-cref_csv(30) => 46.90 s
+cref_csv(30) => 46.90 s
 cref_list_of<>(30) => 10.63 s
 list_of(30) => 2504.00 s
 
 cref_list_of(90) => 58.01 s
-cref_csv(90) => 161.99 s
+cref_csv(90) => 161.99 s
 cref_list_of<>(90) => 34.38 s
 list_of(90) => 8372.00 s
 
 Win7-32 V6.1.7100 - Visual Studio 2010 - Release mode
 cref_list_of(1) => 0.59 s
-cref_csv(1) => 0.04 s
+cref_csv(1) => 0.04 s
 cref_list_of<>(1) => 0.00 s
 list_of(1) => 2964.00 s
 
 cref_list_of(3) => 1.27 s
-cref_csv(3) => 0.05 s
+cref_csv(3) => 0.05 s
 cref_list_of<>(3) => 0.21 s
 list_of(3) => 5158.00 s
 
 cref_list_of(10) => 3.80 s
-cref_csv(10) => 0.04 s
+cref_csv(10) => 0.04 s
 cref_list_of<>(10) => 0.50 s
 list_of(10) => 16914.79 s
 
 cref_list_of(30) => 11.28 s
-cref_csv(30) => 9.41 s
+cref_csv(30) => 9.41 s
 cref_list_of<>(30) => 1.45 s
 list_of(30) => 57972.00 s
 
 cref_list_of(90) => 33.97 s
-cref_csv(90) => 31.40 s
+cref_csv(90) => 31.40 s
 cref_list_of<>(90) => 4.16 s
 list_of(90) =>242709.00 s
 

Modified: sandbox/statistics/detail/assign/libs/assign/example/ref_list_of.cpp
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/example/ref_list_of.cpp (original)
+++ sandbox/statistics/detail/assign/libs/assign/example/ref_list_of.cpp 2010-03-08 14:44:50 EST (Mon, 08 Mar 2010)
@@ -7,7 +7,6 @@
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
 //////////////////////////////////////////////////////////////////////////////
 #include <boost/detail/workaround.hpp>
-#include <libs/assign/test/ref_list_of.h>
 #include <vector>
 #include <set>
 #include <list>
@@ -21,7 +20,6 @@
 //#include <boost/range/chain.hpp>//Uncomment when in release
 #include <boost/assign/auto_size/ref_list_of.hpp>
 #include <boost/assign/auto_size/ref_rebind_list_of.hpp>
-#include <libs/assign/test/ref_list_of.h>
 
 template< class Range >
 void print( const Range& r )
@@ -58,7 +56,6 @@
     return std::max_element( r.begin(), r.end() );
 }
 
-
 template<typename C>
 void check_converter(C& elems,bool sorted = false){
         using namespace boost::assign;


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