Changeset 2316525 for benchmark/ctxswitch
- Timestamp:
- Jan 19, 2020, 4:16:27 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- f090750
- Parents:
- 9e63a2b
- Location:
- benchmark/ctxswitch
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/ctxswitch/cfa_cor.cfa
r9e63a2b r2316525 4 4 #include "bench.h" 5 5 6 coroutine GreatSuspender {};7 void main( __attribute__((unused)) GreatSuspender & this) {8 while ( true) {6 coroutine C {} c; 7 void main( __attribute__((unused)) C & ) { 8 while () { 9 9 suspend(); 10 10 } … … 12 12 int main( int argc, char * argv[] ) { 13 13 BENCH_START() 14 GreatSuspender s;15 14 BENCH( 16 for ( i;times ) {17 resume( s);15 for ( times ) { 16 resume( c ); 18 17 }, 19 18 result -
benchmark/ctxswitch/cfa_cor_then.cfa
r9e63a2b r2316525 6 6 void noOp(void) {} 7 7 8 coroutine GreatSuspender {};8 coroutine C {} c; 9 9 10 void ?{}( GreatSuspender& this ) {10 void ?{}( C & this ) { 11 11 prime(this); 12 12 } 13 13 14 void main( __attribute__((unused)) GreatSuspender& this ) {15 while ( true) {14 void main( __attribute__((unused)) C & this ) { 15 while () { 16 16 suspend_then(noOp); 17 17 } … … 20 20 int main( int argc, char * argv[] ) { 21 21 BENCH_START() 22 GreatSuspender s;23 22 BENCH( 24 for ( i;times ) {25 resume( s);23 for ( times ) { 24 resume( c ); 26 25 }, 27 26 result -
benchmark/ctxswitch/cfa_gen.cfa
r9e63a2b r2316525 3 3 typedef struct { 4 4 void * next; 5 } GreatSuspender;5 } C; 6 6 7 void comain( GreatSuspender * this) {8 if ( __builtin_expect( this->next != 0, 1) ) goto *(this->next);9 this->next = &&s1;7 void comain( C * c ) { 8 if ( __builtin_expect(c->next != 0, 1) ) goto *(c->next); 9 c->next = &&s1; 10 10 for () { 11 11 return; … … 16 16 int main( int argc, char * argv[] ) { 17 17 BENCH_START() 18 GreatSuspender s= { 0 };18 C c = { 0 }; 19 19 BENCH( 20 for ( i;times ) {21 comain( & s);20 for ( times ) { 21 comain( &c ); 22 22 }, 23 23 result -
benchmark/ctxswitch/cfa_thrd.cfa
r9e63a2b r2316525 6 6 BENCH_START() 7 7 BENCH( 8 for ( i;times ) {8 for ( times ) { 9 9 yield(); 10 10 }, -
benchmark/ctxswitch/cfa_thrd2.cfa
r9e63a2b r2316525 8 8 9 9 void main(__attribute__((unused)) Fibre & this) { 10 while (!done) {10 while ( ! done ) { 11 11 yield(); 12 12 } … … 17 17 Fibre f1; 18 18 BENCH( 19 for ( i;times ) {19 for ( times ) { 20 20 yield(); 21 21 }, -
benchmark/ctxswitch/python_cor.py
r9e63a2b r2316525 9 9 times = int( sys.argv[1] ) 10 10 11 def GreatSuspender():11 def C(): 12 12 while True: 13 13 yield 14 14 15 s = GreatSuspender()15 c = C() 16 16 17 17 start = time.time_ns() 18 18 for i in range( 10000000 ): 19 next( s) # resume19 next( c ) # resume 20 20 end = time.time_ns() 21 21 print( (end - start) / times ) -
benchmark/ctxswitch/upp_cor.cc
r9e63a2b r2316525 3 3 #include "bench.h" 4 4 5 _Coroutine GreatSuspender{5 _Coroutine C { 6 6 void main() { 7 7 while( true ) { … … 13 13 resume(); 14 14 } 15 } ;15 } c; 16 16 int main( int argc, char * argv[] ) { 17 17 BENCH_START() 18 GreatSuspender s;19 18 BENCH( 20 19 for (size_t i = 0; i < times; i++) { 21 s.do_resume();20 c.do_resume(); 22 21 }, 23 22 result
Note: See TracChangeset
for help on using the changeset viewer.