Skip to content

Commit

Permalink
use serialised rprof output to avoid knitr profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
lgatto committed Jun 27, 2013
1 parent d87da04 commit 6b425f7
Show file tree
Hide file tree
Showing 4 changed files with 375 additions and 11 deletions.
10 changes: 5 additions & 5 deletions R-programming.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ library("microbenchmark")
microbenchmark(sol2(ll), sol3(ll), times = 200)


## @knitr profiling, cache = TRUE
Rprof()
tmp <- replicate(10, sol3(ll))
Rprof(NULL)
## @knitr profiling, eval=FALSE
## Rprof("sol3.Rprof")
## tmp <- replicate(10, sol3(ll))
## Rprof(NULL)


## @knitr opts0, echo=FALSE
Expand All @@ -183,7 +183,7 @@ options(width = 100)


## @knitr smryprof, size = 'small'
summaryRprof()
summaryRprof("sol3.Rprof")


## @knitr opts1, echo=FALSE
Expand Down
12 changes: 6 additions & 6 deletions R-programming.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ profiling by calling \Rfunction{Rprof()} (optionally passing a custom file name
From now on, every function call is going to be timed until profiling is switched of with
\Rfunction{Rprof(NULL)}.

<<profiling, cache = TRUE>>=
Rprof()
<<profiling, eval=FALSE>>=
Rprof("sol3.Rprof")
tmp <- replicate(10, sol3(ll))
Rprof(NULL)
@
Expand All @@ -450,11 +450,11 @@ options(width = 100)
@

<<smryprof, size = 'small'>>=
summaryRprof()
summaryRprof("sol3.Rprof")
@

Note that many of the functions shown above are not part of our benchmarking but
result in the compilation of this reproducible vignette.
%% Note that many of the functions shown above are not part of our benchmarking but
%% result in the compilation of this reproducible vignette.

<<opts1, echo=FALSE>>=
options(width = oldwidth)
Expand Down Expand Up @@ -559,7 +559,7 @@ In this section, we consider two frameworks.
parallelised functions must be exported to each node of the cluster.
This is achieved with the \Rfunction{clusterExport}.

\item The \R~process is \textit{forked} to create new \R~processes by taking a
\item The \R process is \textit{forked} to create new \R processes by taking a
complete copy of the masters process, including the workspace
(pioneered by package \Rpackage{multicore}). This does not work on Windows though
and the parallel function will fall back in serialised execution (\Robject{mc.cores = 1}).
Expand Down
Binary file modified R-programming.pdf
Binary file not shown.
Loading

0 comments on commit 6b425f7

Please sign in to comment.