Closed
Description
While data.table new column := used to be >100x faster than base R, base R (>=3.1) updates now data.frames in place and caught up. I wonder why data.table is slower for example in this case:
library(data.table)
dt <- data.table(x = runif(100e6))
df <- as.data.frame(dt)
system.time( df$y <- 2*df$x )
system.time( dt[,y := 2*x] )
I get:
base R: 0.272 0.300 0.572 (user system elapsed)
data.table: 0.696 0.744 1.444
R 3.1.1 data.table 1.9.4.
Metadata
Assignees
Labels
No labels