<div dir="ltr">Hi Arun,<div><br></div><div>Yup, windows (see below).</div><div><br></div><div>I tried debugonce, but didn't really know what I was looking for. Every step was instantaneous except this one:</div><div><br>
</div><div><div><font face="courier new, monospace">debug: ans = .Call(Cdogroups, x, xcols, groups, grpcols, jiscols, grporder, </font></div><div><font face="courier new, monospace"> o__, f__, len__, jsub, SDenv, cols, newnames, verbose)</font></div>
</div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">--Frank</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">sessionInfo()</font></div>
<div><br></div><div><div><font face="courier new, monospace">R version 3.0.1 (2013-05-16)</font></div><div><font face="courier new, monospace">Platform: x86_64-w64-mingw32/x64 (64-bit)</font></div><div><font face="courier new, monospace"><br>
</font></div><div><font face="courier new, monospace">locale:</font></div><div><font face="courier new, monospace">[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C </font></div>
<div><font face="courier new, monospace">[5] LC_TIME=English_United States.1252 </font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">attached base packages:</font></div>
<div><font face="courier new, monospace">[1] stats graphics grDevices utils datasets methods base </font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">other attached packages:</font></div>
<div><font face="courier new, monospace">[1] rbenchmark_1.0.0 data.table_1.8.8</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">loaded via a namespace (and not attached):</font></div>
<div><font face="courier new, monospace">[1] tools_3.0.1</font></div></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 16, 2013 at 5:37 AM, Arunkumar Srinivasan <span dir="ltr"><<a href="mailto:aragorn168b@gmail.com" target="_blank">aragorn168b@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
Frank,
</div><div>Is it a windows machine as well?</div><div>And could you try to use `debugonce` to find out the line(s) where it's slow?</div>
<div><div><br></div><div>Arun</div><div><br></div></div><div class="HOEnZb"><div class="h5">
<p style="color:#a0a0a8">On Friday, August 16, 2013 at 12:34 PM, Frank Erickson wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px">
<span><div><div><div dir="ltr"><div>I get similar timings to arun, with the data.table call being a lot slower than the other timings. If data.table is not optimized for that .SD expression, perhaps that is okay because, as Arun pointed out, there are alternatives.. I can't guess why it would perform differently on different hardware, though...</div>
<div><br></div><div># alternatives:</div><div><div><font face="courier new, monospace">a <- dt1[dt1[, .I[.N], by='Date']$V1]</font></div>
<div><font face="courier new, monospace">b <- dt1[J(unique(Date)),,mult='last'] # a little slower</font></div><div><font face="courier new, monospace">d <- dt1[, .SD[.N], by='Date'] # 600x slower; it would take ages to benchmark</font></div>
<div><font face="courier new, monospace">identical(a,b) # true</font></div><div><font face="courier new, monospace">identical(a,d) # false</font></div><div><font face="courier new, monospace">identical(as.data.frame(d),as.data.frame(a)) # true</font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">--Frank</font></div><div><br></div></div></div>
</div></div></span>
</blockquote>
<div>
<br>
</div>
</div></div></blockquote></div><br></div>