https://github.com/duncantl/RLLVMCompile
Raw File
Tip revision: 7fad5bd394a6f74ace0f6053a5d08e4f15cf3a1f authored by Duncan Temple Lang on 07 March 2017, 00:49:31 UTC
correct name for variable
Tip revision: 7fad5bd
vectorize.R
library(RLLVMCompile)
f = function(x) x + 1L
mod = Module()
fc = compileFunction(f, Int32Type, Int32Type, module = mod)
g = function(x) sapply(x, f)
gc = compileFunction(g, getSEXPType("INT"), getSEXPType("INT"), module = mod)

.llvm(fc, 1)
.llvm(gc, 1:10)

ee = ExecutionEngine(mod)
tm = system.time(replicate(1e5, .llvm(fc, 1L)))
tm = system.time(replicate(1e5, .llvm(fc, 1L, .ee = ee)))


back to top