Profiling with RStudio and profvis

转载 2016年06月01日 15:22:54

“How can I make my code faster?” If you write R code, then you’ve probably asked yourself this question. A profiler is an important tool for doing this: it records how the computer spends its time, and once you know that, you can focus on the slow parts to make them faster.

The preview releases of RStudio now have integrated support for profiling R code and for visualizing profiling data. R itself has long had a built-in profiler, and now it’s easier than ever to use the profiler and interpret the results.

To profile code with RStudio, select it in the editor, and then click onProfile -> Profile Selected Line(s). R will run that code with the profiler turned on, and then open up an interactive visualization.

In the visualization, there are two main parts: on top, there is the code with information about the amount of time spent executing each line, and on the bottom there is a flame graph, which shows R was doing over time. In the flame graph, the horizontal direction represents time, moving from left to right, and the vertical direction represents the call stack, which are the functions that are currently being called. (Each time a function calls another function, it goes on top of the stack, and when a function exits, it is removed from the stack.)


The Data tab contains a call tree, showing which function calls are most expensive:

Profiling data pane

Armed with this information, you’ll know what parts of your code to focus on to speed things up!

The interactive profile visualizations are created with the profvispackage, which can be used separately from the RStudio IDE. If you use profvis outside of RStudio, the visualizations will open in a web browser.

To learn more about interpreting profiling data, check out theprofvis website, which has interactive demos. You can also find out more about profiling with RStudio there.


Profiling with Traceview and dmtracedump

Traceview is a graphical viewer for execution logs that you create by using theDebug class to log ...

Blog with RStudio, R, RMarkdown, Jekyll and Github

In the first post of this new blog I’ll outline how I’ve set the blog up. writing posts in Rmarkd...

Write Posts With Rstudio, Rmarkdown Format And Publish Directly To Wordpress With Knitr & Rwordpress

Introduction Objective chinaPleth is designed to be fully open, free and reproducible. This po...


作者 Joachim Haagen Skeie 译者 李勇 发布于 2011年11月9日 领域 语言 & 开发 主题 工具 , 性能和可伸缩性 , Java 标签 性能调优 , 开源...
  • fjfdszj
  • fjfdszj
  • 2011年11月09日 23:53
  • 521

Adding profiling instructions to applications with Soot

Adding profiling instructions to applications with Soot Feng Qian ( Patric...
  • qc_liu
  • qc_liu
  • 2014年11月13日 16:12
  • 521

Set up remote profiling with JProfiler

Background: Remote machine: (Byte the way, checking some hardware and software information: ...
  • apchee
  • apchee
  • 2011年09月07日 16:23
  • 294


  • 2011年10月19日 09:28
  • 7.83MB
  • 下载
您举报文章:Profiling with RStudio and profvis