Rcpp Version 0.9.10
overhead.r
Go to the documentation of this file.
00001 #!/usr/bin/r
00002 
00003 set.seed(42)
00004 a <- rnorm(100)
00005 b <- rnorm(100)
00006 
00007 ## load shared libraries with wrapper code
00008 dyn.load("overhead_1.so")
00009 dyn.load("overhead_2.so")
00010 
00011 overhead_c_symbol <- getNativeSymbolInfo( "overhead_c" )
00012 overhead_cpp_symbol <- getNativeSymbolInfo( "overhead_cpp" )
00013 
00014 overhead_c <- function(a,b) .Call( overhead_c_symbol, a, b )
00015 overhead_cpp <- function(a,b) .Call( overhead_cpp_symbol, a, b )
00016 
00017 ## load benchmarkin helper function
00018 suppressMessages(library(rbenchmark))
00019 
00020 benchmark(
00021 
00022     overhead_cpp(a,b),
00023     overhead_c(a,b),
00024     
00025             columns=c("test", "replications", "elapsed", "relative", "user.self", "sys.self"),
00026                 order="relative",
00027                 replications=10000)
00028 
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Defines