<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
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:<br><br><font style="" face="Courier New">USArrests.dt <- data.table(USArrests)</font><font style="" face="Courier New"><br></font><font style="" face="Courier New">lst.USArrests <- replicate(1000, USArrests, simplify=FALSE)</font><font style="" face="Courier New"><br></font><font style="" face="Courier New">lst.USArrests.dt <- replicate(1000, USArrests.dt, simplify=FALSE)</font><font style="" face="Courier New"><br><br>microbenchmark(do.call(cbind, lst.USArrests),<br> do.call(cbind, lst.USArrests.dt),<br> times=10)</font><br><pre tabindex="0" class="ecxGJWPQFQDK4" style="font-family:Consolas, 'Lucida Console', monospace;font-size:14px;border:none;white-space:pre-wrap !important;line-height:15px;color:rgb(255, 255, 255);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:-webkit-left;text-indent:0px;text-transform:none;widows:auto;word-spacing:0px;background-color:rgb(50, 50, 50)">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</pre><br>This is run on an Ubuntu system. </div></body>
</html>