Sunday, January 22, 2012

Some Rcpp benchmarks

I ran the Fibonacci number example from the Rcpp package on a number of computers and operating systems. Here are the results:

A. On my main computer (Core 2 Extreme 3.06GHz, 8 GB memory) running Ubuntu 10.04 (g++ 4.4.3):
        test replications elapsed relative user.self sys.self
3 fibRcpp(N)            1   0.148   1.0000      0.14     0.01
1    fibR(N)            1  87.078 588.3649     87.03     0.04
2   fibRC(N)            1  91.209 616.2770     91.14     0.07

B. Same computer running Windows Vista (g++ 4.5.0):

        test replications elapsed relative user.self sys.self
3 fibRcpp(N)            1    0.21   1.0000      0.21     0.00
1    fibR(N)            1   92.08 438.4762     90.47     0.05
2   fibRC(N)            1   94.39 449.4762     93.13     0.03


C. On my second laptop (Core 2 Duo 2.53GHz, 4 GB memory) running Windows 7 (g++ 4.5.0):

        test replications elapsed relative user.self sys.self
3 fibRcpp(N)            1    0.17   1.0000      0.17     0.00
1    fibR(N)            1   73.62 433.0588     73.47     0.00
2   fibRC(N)            1   74.27 436.8824     74.20     0.03

D. On the same computer running Revolution R Enterprise 5:
      test replications elapsed relative user.self sys.self
2 fibRC(N)            1   72.31 1.000000     72.09        0
1  fibR(N)            1   72.99 1.009404     72.79        0 

E. On my third laptop (Core 2 Duo 2.50GHz, 2 GB memory) running Mint Debian (g++ 4.6.2):
        test replications elapsed relative user.self sys.self
3 fibRcpp(N)            1   0.148   1.0000     0.148     0.00
1    fibR(N)            1  65.535 442.8041     65.328    0.200
2   fibRC(N)            1  65.664 443.6757     65.492    0.172


Why the faster computer performed worse, on both R and Rcpp versions?

1 comment:

Michael Z. said...

And why is the byte-compiled version always slower than the pure R version?

Counter