<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/inputoutput-benchmarks/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://csgillespie.wordpress.com/2017/01/22/inputoutput-benchmarks/"> R – Why?</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>To quantify the impact of the CPU on an analysis, I created the package <a target="_blank" rel="nofollow" href="https://github.com/csgillespie/benchmarkme">benchmarkme</a>. The idea is simple. If everyone runs the same R script, we can easily compare machines.</p>
<p>One of the benchmarks in the package is for comparing read/write speeds; we write a large CSV file (using write.csv) and read it back in using read.csv</p>
<p>The package is on CRAN can be installed in the usual way</p>
<pre>install.packages(&quot;benchmarkme&quot;)</pre>
<p>Running</p>
<pre>library(benchmarkme)
## If your computer is relatively slow, remove 200 from below
res = benchmark_io(runs = 3, size = c(5, 50, 200))
## Upload you data set
upload_results(res)</pre>
<p>creates three matrices of size 5MB, 20MB and 200MB, writes the associated CSV file to the directory</p>
<pre>Sys.getenv(&quot;TMPDIR&quot;)</pre>
<p>and then reads the data set back into R. The object res contains the timings which can compared to other users via</p>
<pre>plot(res)</pre>
<p><img sizes="(max-width: 300px) 100vw, 300px" data-image-description="" data-orig-file="https://csgillespie.files.wordpress.com/2017/01/rplot011.png" data-orig-size="622,482" data-image-title="rplot01" class="wp-image-1177" data-comments-opened="1" data-recalc-dims="1" data-attachment-id="1177" data-permalink="https://csgillespie.wordpress.com/?attachment_id=1177" alt="rplot01" data-medium-file="https://csgillespie.files.wordpress.com/2017/01/rplot011.png?w=300" data-large-file="https://csgillespie.files.wordpress.com/2017/01/rplot011.png?w=622" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" src="https://i0.wp.com/csgillespie.files.wordpress.com/2017/01/rplot011.png?resize=300%2C232&ssl=1"></p>
<p>The above graph plots the current benchmarking results for writing a 5MB file (my machine is relatively fast).</p>
<h2>Shiny</h2>
<p>You can also compare your results using the <a target="_blank" rel="nofollow" href="https://jumpingrivers.shinyapps.io/benchmarkme/">Shiny</a> interface. Simply create a results bundle</p>
<pre> create_bundle(res, filename = &quot;results.rds&quot;)</pre>
<p>and upload to the <a target="_blank" rel="nofollow" href="https://jumpingrivers.shinyapps.io/benchmarkme/">webpage</a>.</p>
<h2>Network drives</h2>
<p>Often the dataset we wish to access is on a network drive. Unfortunately, network drives can be slow. The benchmark_io function has an argument that allows us to change the directory and estimate the network drive impact</p>
<pre>res_net = benchmark_io(runs = 3, size = c(5, 20, 200), 
                           tmpdir = &quot;path_to_dir&quot;)</pre>
<p> </p>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/csgillespie.wordpress.com/1201/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/csgillespie.wordpress.com/1201/" border="0"></a> <img alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://csgillespie.wordpress.com/2017/01/22/inputoutput-benchmarks/"> R – Why?</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/LNHNBs9M_zs"></a></div>