<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>
                 
                <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>