[datatable-help] data.table and cbind()
Sadao Milberg
s_milberg at hotmail.com
Fri Mar 22 23:23:06 CET 2013
I've recently discovered the dramatic performance improvements
data.table provides over ddply() and merge(), and I'm looking forward to
integrating it into my work. While messing around with benchmarks, I
ran into an unexpected outcome with cbind(), where operations are
actually much faster with data frames than data tables. Don't ask my
why I'd ever do the following, but I am curious as to why it is so much
slower:
USArrests.dt <- data.table(USArrests)
lst.USArrests <- replicate(1000, USArrests, simplify=FALSE)
lst.USArrests.dt <- replicate(1000, USArrests.dt, simplify=FALSE)
microbenchmark(do.call(cbind, lst.USArrests),
do.call(cbind, lst.USArrests.dt),
times=10)
Unit: milliseconds
expr min lq median uq max neval
do.call(cbind, lst.USArrests) 42.26891 47.70086 48.71271 49.88542 51.25453 10
do.call(cbind, lst.USArrests.dt) 750.70469 761.70511 773.91232 816.85707 880.45896 10
This is run on an Ubuntu system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20130322/804da446/attachment.html>
More information about the datatable-help
mailing list