|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51588 - sandbox/reference_closure
From: dave_at_[hidden]
Date: 2009-03-03 21:05:21
Author: dave
Date: 2009-03-03 21:05:19 EST (Tue, 03 Mar 2009)
New Revision: 51588
URL: http://svn.boost.org/trac/boost/changeset/51588
Log:
Lawrence's original code
Added:
sandbox/reference_closure/benchmark.sh (contents, props changed)
sandbox/reference_closure/trivial_closure.h (contents, props changed)
sandbox/reference_closure/trivial_function.cc (contents, props changed)
sandbox/reference_closure/trivial_initiator.h (contents, props changed)
sandbox/reference_closure/trivial_main.h (contents, props changed)
sandbox/reference_closure/trivial_nested.cc (contents, props changed)
Added: sandbox/reference_closure/benchmark.sh
==============================================================================
--- (empty file)
+++ sandbox/reference_closure/benchmark.sh 2009-03-03 21:05:19 EST (Tue, 03 Mar 2009)
@@ -0,0 +1,12 @@
+CC=/home/build/buildtools/crosstool/v10/gcc-4.2.1-glibc-2.3.5/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-g++
+
+echo compile trivial_nested
+time $CC -O2 trivial_nested.cc -o trivial_nested
+echo execute trivial_nested
+time trivial_nested
+
+echo compile trivial_function
+time $CC -O2 trivial_function.cc -o trivial_function
+echo execute trivial_function
+time trivial_function
+
Added: sandbox/reference_closure/trivial_closure.h
==============================================================================
--- (empty file)
+++ sandbox/reference_closure/trivial_closure.h 2009-03-03 21:05:19 EST (Tue, 03 Mar 2009)
@@ -0,0 +1,7 @@
+struct frame { };
+void nested( frame* ) { }
+struct closure {
+ void (*func)( frame* );
+ frame* scope;
+ void operator()() { func( scope ); }
+};
Added: sandbox/reference_closure/trivial_function.cc
==============================================================================
--- (empty file)
+++ sandbox/reference_closure/trivial_function.cc 2009-03-03 21:05:19 EST (Tue, 03 Mar 2009)
@@ -0,0 +1,7 @@
+#include <tr1/functional>
+using std::tr1::function;
+void executer( function<void()> arg ) { arg(); }
+void passer( function<void()> arg ) { executer( arg ); }
+#include "trivial_closure.h"
+#include "trivial_initiator.h"
+#include "trivial_main.h"
Added: sandbox/reference_closure/trivial_initiator.h
==============================================================================
--- (empty file)
+++ sandbox/reference_closure/trivial_initiator.h 2009-03-03 21:05:19 EST (Tue, 03 Mar 2009)
@@ -0,0 +1,5 @@
+void initiator() {
+ frame mine; closure child;
+ child.func = nested; child.scope = &mine;
+ passer( child );
+}
Added: sandbox/reference_closure/trivial_main.h
==============================================================================
--- (empty file)
+++ sandbox/reference_closure/trivial_main.h 2009-03-03 21:05:19 EST (Tue, 03 Mar 2009)
@@ -0,0 +1,5 @@
+int main() {
+ for ( int i = 0; i < 1000*1000*1000; i++ )
+ initiator();
+ return 0;
+}
Added: sandbox/reference_closure/trivial_nested.cc
==============================================================================
--- (empty file)
+++ sandbox/reference_closure/trivial_nested.cc 2009-03-03 21:05:19 EST (Tue, 03 Mar 2009)
@@ -0,0 +1,5 @@
+#include "trivial_closure.h"
+void executer( closure arg ) { arg(); }
+void passer( closure arg ) { executer( arg ); }
+#include "trivial_initiator.h"
+#include "trivial_main.h"
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