使用JIT与R的可能缺点? [英] Possible shortcomings for using JIT with R?

查看:293
本文介绍了使用JIT与R的可能缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近发现,可以使用编译器包使用JIT(只是及时)编译R(我总结了我在最近的博客文章)。

I recently discovered that one can use JIT (just in time) compilation with R using the compiler package (I summarizes my findings on this topic in a recent blog post).

我问的问题之一是:


有什么陷阱?

看了一遍后,我可以找到一个可能的问题与JIT的启动时间有关。但是在使用JIT时还有其他问题需要注意吗?

After looking around I could find one possible issue having to do with the "start up" time for the JIT. But is there any other issue to be careful about when using JIT?

我猜想与R的环境架构有一些限制,但我不能

I guess that there will be some limitation having to do with R's environments architecture, but I can not think of a simple illustration of the problem off the top of my head, any suggestions or red flags will be of great help?

推荐答案

library("rpart")
fo = function() {
  for(i in 1:500){
    rpart(Kyphosis ~ Age + Number + Start, data=kyphosis)
  }
}    system.time(fo())
#   user  system elapsed 
#  1.212   0.000   1.206 
compiler::enableJIT(3)
# [1] 3
system.time(fo())
#   user  system elapsed 
#  1.212   0.000   1.210 

我还尝试过其他一些例子,例如

I've also tried a number of other examples, such as


  • li>
  • 一个只是包装器的函数意味着

  • growing a vector;
  • A function that's just a wrapper around mean

虽然我并不总是得到加速,但我从来没有经历过显着的减速。

While I don't always get a speed-up, I've never experience a significant slow-down.

R> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04 LTS

这篇关于使用JIT与R的可能缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆