Rcpp Version 1.0.14
Loading...
Searching...
No Matches
overhead.r
Go to the documentation of this file.
1#!/usr/bin/env r
2
3set.seed(42)
4a <- rnorm(100)
5b <- rnorm(100)
6
7## load shared libraries with wrapper code
8dyn.load("overhead_1.so")
9dyn.load("overhead_2.so")
10
11overhead_c_symbol <- getNativeSymbolInfo( "overhead_c" )
12overhead_cpp_symbol <- getNativeSymbolInfo( "overhead_cpp" )
13
14overhead_c <- function(a,b) .Call( overhead_c_symbol, a, b )
15overhead_cpp <- function(a,b) .Call( overhead_cpp_symbol, a, b )
16
17## load benchmarkin helper function
18suppressMessages(library(rbenchmark))
19
20res <- benchmark(overhead_cpp(a,b), overhead_c(a,b),
21 columns=c("test", "replications", "elapsed", "relative", "user.self", "sys.self"),
22 order="relative",
23 replications=10000)
24print(res)