[問題] lineprof 可否決定層數?
最近要檢查一支程式為何越來越慢 (因為陸陸續續修改,有陸續加東西)
我用 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)
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.64.48
※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1477287280.A.392.html
→
10/24 13:38, , 1F
10/24 13:38, 1F
→
10/24 13:38, , 2F
10/24 13:38, 2F
※ 編輯: Edster (140.112.64.48), 10/24/2016 13:38:57
→
10/24 13:39, , 3F
10/24 13:39, 3F
→
10/24 13:39, , 4F
10/24 13:39, 4F
→
10/24 13:40, , 5F
10/24 13:40, 5F
→
10/24 13:41, , 6F
10/24 13:41, 6F
→
10/24 13:42, , 7F
10/24 13:42, 7F
→
10/24 13:42, , 8F
10/24 13:42, 8F
→
10/24 13:42, , 9F
10/24 13:42, 9F
R_Language 近期熱門文章
PTT數位生活區 即時熱門文章