Skip to content

Instantly share code, notes, and snippets.

@MichaelChirico
Created February 23, 2018 03:49
Show Gist options
  • Save MichaelChirico/afb9949027d720629f0934a5398108b7 to your computer and use it in GitHub Desktop.
Save MichaelChirico/afb9949027d720629f0934a5398108b7 to your computer and use it in GitHub Desktop.
script to call fread_speed.R & produce plot
#from CRAN initially
install.packages('data.table')
library(data.table)
# could be rvest'ed
commits = fread('date,commit
2018-02-22,5174a8c921eb28c73fa4489214cab3850b120a33
2018-02-20,15abd60ddc48f55d2663286740199fcd3d8d6206
2018-02-18,01ef8e3ebf805ad3e364d5722b6c3622edeebcdb
2018-02-16,2e83d3c638ad50f289767bd48a2ab68454ecd1c7
2018-02-14,dfcd71dc0c9ca89d78fdcf38a77a43872d27f8cb
2018-02-10,c4ae884a6902d7e9f5fb84ee1c785ff8f00187e6
2018-01-31,a00d43f0fc7ac060b2c0c960145e2a05cca3cce4
2018-01-25,cc60b78b1c1098d896f1d42b0386aae9380d44cf
2018-01-23,b3b04c86343a9b9968e0eb65af957d07dea4772f
2018-01-18,da43dc04677cd3c565ccf0c00b1ec818de8ef174
2018-01-04,f1d10c5fe9a1ac9111ab0e0d32cf014d6fe4075a
2018-01-04,2a9ce6126cf2dcf32402da057172f568ca8fe815
2018-01-04,8458775c5e40bcb6907dfa9cd61bab43a43097e3
2018-01-03,1c4af715f8b0b6011d3595c06d0d0440a9b4acc2
2017-12-08,6f6785acc2e38d7993d5543b8fa2e5170c668eda
2017-12-07,8461cec283f015067919e3611db6f312e686b7b0
2017-11-22,fda02e88465674a546e5c3d69d22420577581456
2017-11-15,b55426426011375badce9ac46d1d00e445b56481
2017-11-15,4a26c3346b0e9324baa3c928dd167b896b8bf81d
2017-11-09,1b8e886d8bf144ac1b3c039660d6a1ab4609e8de
2017-10-31,1fc5cbaa32856a0732f6f8b78ef759095da0f22b
2017-10-28,7357a3a626a7876efd3beddc6397e1f5dbd4ab2a
2017-10-24,9bbe55fdf917095b7d1a345692621ccc493f9cfc
2017-10-24,6015373954b8bcccedca3560e9aa840826348fc0
2017-09-25,ec05f8b1665ee889ee22ff98925733d3c6cfff6c
2017-09-23,a842e77942c212f4d9c47933c3dc66d685c47972
2017-09-22,224fd1f4a1fd07fdb903e3403541f3fbb557ca2a
2017-09-22,d21a6875374bcbe7fc12618def9af2949717ef2e
2017-09-21,edb6b31ff1390560d96feb307b1ab119553615d7
2017-09-16,328c2fe6017ca0a228a2171520f054c0b28308ee
2017-09-15,6140ef71ca91235c8c87fc2418c3f43b4881731b
2017-09-15,1211d95f2f6aac451e81740422ace214d1a42944
2017-09-14,2f41b0ad78a19fcdf04d752f5e085e0f093717ad
2017-09-14,cf51dd1a47643808d9f84075d069192ac6ec3b3e
2017-09-13,5e5c4515855f7997eb29f3399a15fbadcfe7f671')
# for plotting
commits[ , commit6 := substring(commit, 1L, 6L)]
commits[ , date := as.IDate(date)]
commits[ , timing := sapply(commit, function(c) {
system(sprintf('Rscript fread_speed.R %s', c), intern = TRUE)
})]
commits = commits[ , .(timing = unlist(strsplit(timing, ',', fixed = TRUE))),
by = .(date, commit, commit6)]
commits[ , {
png('fread_timings.png')
plot(date, timing, xlab = 'Date', ylab = 'Seconds', xaxt = 'n',
main = paste0("fread timing since September '17\n",
'10 files (9GB disk/7.5GB RAM), 46M rows x 26 columns'))
day1s = as.IDate('2017-09-01') +
cumsum(c(0, 30, 31, 30, 31, 31, 28))
axis(side = 1L, at = as.integer(day1s),
labels = format(day1s, '%Y-%m'))
text(date, timing, labels = commit6,
cex = .5, pos = 3L)
dev.off()
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment