Changeset b4107c8 for benchmark/creation


Ignore:
Timestamp:
Jan 7, 2020, 3:50:56 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
580c11b
Parents:
846c026
Message:

update existing benchmarks for changes to bench.h, add new benchmarks in new programming languages

Location:
benchmark/creation
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • benchmark/creation/JavaThread.java

    r846c026 rb4107c8  
    2626        static int x = 2;
    2727
    28         static private final int NoOfTimes = Integer.parseInt("10000") ;
     28        static private int times = Integer.parseInt("10000") ;
    2929
    3030        public static class MyThread extends Thread {
     
    4747        }
    4848        public static void main(String[] args) throws InterruptedException {
    49                 for (int n = Integer.parseInt("5"); --n >= 0 ; ) {
     49                if ( args.length > 2 ) System.exit( 1 );
     50                if ( args.length == 2 ) { times = Integer.parseInt(args[1]); }
     51
     52                for (int i = Integer.parseInt("5"); --i >= 0 ; ) {
    5053                        InnerMain();
    51                         Thread.sleep(2000);     // 2 seconds
     54                        Thread.sleep(2000);     // 2 seconds
    5255                        x = nextRandom(x);
    5356                }
     
    5558        }
    5659}
     60
     61// Local Variables: //
     62// tab-width: 4 //
     63// End: //
  • benchmark/creation/cfa_cor.cfa

    r846c026 rb4107c8  
    1212void main(MyCoroutine &) {}
    1313
    14 int main(int argc, char* argv[]) {
     14int main( int argc, char * argv[] ) {
     15        BENCH_START()
    1516        BENCH(
    16                 for ( i; n ) {
     17                for ( i; times ) {
    1718                        MyCoroutine m;
    1819                },
    1920                result
    2021        )
     22        printf( "%g\n", result );
     23}
    2124
    22         printf("%g\n", result);
    23 }
     25// Local Variables: //
     26// tab-width: 4 //
     27// End: //
  • benchmark/creation/cfa_thrd.cfa

    r846c026 rb4107c8  
    77void main(MyThread &) {}
    88
    9 int main(int argc, char* argv[]) {
     9int main( int argc, char * argv[] ) {
     10        BENCH_START()
    1011        BENCH(
    11                 for ( i; n ) {
     12                for ( i; times ) {
    1213                        MyThread m;
    1314                },
    1415                result
    1516        )
     17        printf( "%g\n", result );
     18}
    1619
    17         printf("%g\n", result);
    18 }
     20// Local Variables: //
     21// tab-width: 4 //
     22// End: //
  • benchmark/creation/goroutine.go

    r846c026 rb4107c8  
    44    "fmt"
    55    "time"
     6    "flag"
    67)
    78
     
    1718
    1819func main() {
    19         const NoOfTimes = 500000
     20        times := flag.Int( "times", 500000, "loop iterations" )
     21        flag.Parse()
    2022        start := time.Now()
    21         for i := 1; i <= NoOfTimes; i += 1 {
     23        for i := 1; i <= *times; i += 1 {
    2224                go noop()               // creation
     25                <- shake                // wait for completion
    2326        }
    2427        end := time.Now()
    25         fmt.Printf("%d\n", end.Sub(start) / time.Duration(NoOfTimes))
    26         <- shake
     28        fmt.Printf( "%d\n", end.Sub(start) / time.Duration(*times) )
    2729}
     30
     31// Local Variables: //
     32// tab-width: 4 //
     33// End: //
  • benchmark/creation/pthreads.c

    r846c026 rb4107c8  
    44#include "bench.h"
    55
    6 static void *foo(void *arg) {
     6static void * foo(void *arg) {
    77    return arg;
    88}
    99
    10 int main(int argc, char* argv[]) {
     10int main( int argc, char * argv[] ) {
     11        BENCH_START()
    1112        BENCH(
    12                 for (size_t i = 0; i < n; i++) {
     13                for (size_t i = 0; i < times; i++) {
    1314                        pthread_t thread;
    1415                        if (pthread_create(&thread, NULL, foo, NULL) < 0) {
     
    1617                                return 1;
    1718                        }
    18 
    1919                        if (pthread_join( thread, NULL) < 0) {
    2020                                perror( "failure" );
     
    2424                result
    2525        )
     26        printf( "%g\n", result );
     27}
    2628
    27         printf("%g\n", result);
    28 }
     29// Local Variables: //
     30// tab-width: 4 //
     31// End: //
  • benchmark/creation/upp_cor.cc

    r846c026 rb4107c8  
    77};
    88
    9 int main(int argc, char* argv[]) {
     9int main( int argc, char * argv[] ) {
     10        BENCH_START()
    1011        BENCH(
    11                 for (size_t i = 0; i < n; i++) {
     12                for (size_t i = 0; i < times; i++) {
    1213                        MyCor m;
    1314                },
    1415                result
    1516        )
     17        printf( "%g\n", result );
     18}
    1619
    17         printf("%g\n", result);
    18 }
     20// Local Variables: //
     21// tab-width: 4 //
     22// End: //
  • benchmark/creation/upp_thrd.cc

    r846c026 rb4107c8  
    77};
    88
    9 int main(int argc, char* argv[]) {
     9int main( int argc, char * argv[] ) {
     10        BENCH_START()
    1011        BENCH(
    11                 for (size_t i = 0; i < n; i++) {
     12                for (size_t i = 0; i < times; i++) {
    1213                        MyThread m;
    1314                },
    1415                result
    1516        )
     17        printf( "%g\n", result );
     18}
    1619
    17         printf("%g\n", result);
    18 }
     20// Local Variables: //
     21// tab-width: 4 //
     22// End: //
Note: See TracChangeset for help on using the changeset viewer.