[问题] lineprof 可否决定层数?

楼主: Edster (Edster)   2016-10-24 13:34:31
最近要检查一支程式为何越来越慢 (因为陆陆续续修改,有陆续加东西)
我用 hadley 大神写的 lineprof pkg 来确认。
可参考
http://adv-r.had.co.nz/Profiling.html
https://github.com/hadley/lineprof
想偷懒看中文也是有 (我是英文看完才发现有中文)
http://blog.fens.me/r-perform-lineprof/
虽然看的到function中"每支" function 的执行时间,
但是我想知道的是某层 function 的总执行时间,
他的资料结构我也不太容易输出成 csv 自己加
因此想请问有经验的板友
我可否在设定上使用 lineprof 来计算某层function的总执行时间?
或是用什么方式输出成档案自己加?
感谢先。
ps:
如果想要装的话,要从GitHub自己下载source自己转成binary
以下是我的安装过程,后面附的是官方范例。
devtools或是Rcpp可能要先删掉重新装。
==
install.packages("devtools")
install.packages("Rcpp")
library(devtools)
devtools::install_github("hadley/lineprof")
install_github("wch/shiny-slickgrid",force=TRUE)
library(lineprof)
library(shiny)
source(find_ex("read-delim.r"))
source(find_ex("read-table.r")) # local copy so get line numbers
wine <- find_ex("wine.csv")
## Not run:
y1 = read.table2(wine, sep = ",")
system.time(x1 <- lineprof(read.table2(wine, sep = ","), torture = TRUE))
x2 <- lineprof(read_delim(wine), torture = TRUE)
shine(x1)
shine(x2)
作者: celestialgod (天)   2016-10-24 13:38:00
Hadley XDD 你果然不想尊重他为大神XDD
楼主: Edster (Edster)   2016-10-24 13:38:00
ps, 执行的时候会让人觉得很像当机. 那就是正在执行.
作者: celestialgod (天)   2016-10-24 13:39:00
后来lineprof已经废弃,改用profvis了http://rpubs.com/wch/178493
楼主: Edster (Edster)   2016-10-24 13:40:00
typeof 难免, 先对大神说抱歉.
作者: celestialgod (天)   2016-10-24 13:41:00
typo?
楼主: Edster (Edster)   2016-10-24 13:42:00
profvis 看起来更华丽,而且看来有"层"的概念,来用用。
作者: celestialgod (天)   2016-10-24 13:42:00
左边expr下面是执行的命令,下面会列出里面各层的程式码,感觉应该符合你的需求

Links booklink

Contact Us: admin [ a t ] ucptt.com