Site icon R-bloggers

Some Rcpp benchmarks

[This article was first published on Shige's Research Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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?

To leave a comment for the author, please follow the link and comment on their blog: Shige's Research Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.