-
Notifications
You must be signed in to change notification settings - Fork 977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speedup DT[,.N,by=]. Currently evals j per group. #1251
Comments
Note that it's not optimised only when require(data.table)
dt = data.table(x=rep(1:3, each=2), y=1:6)
options(datatable.verbose=TRUE)
dt[, .(.N, mean(y)), by=x]
# Detected that j uses these columns: y
# Finding groups (bysameorder=FALSE) ... done in 0secs. bysameorder=TRUE and o__ is length 0
# lapply optimization is on, j unchanged as 'list(.N, mean(y))'
# GForce optimized j to 'list(.N, gmean(y))' |
Now I get: require(data.table)
DT = data.table(a=1:1e8, b=1:2)
options(datatable.optimize=1L) # no GForce
system.time(DT[, .(.N), by=a])
# user system elapsed
# 25.598 0.801 26.882
system.time(DT[, .N, by=a])
# user system elapsed
# 15.395 1.056 16.832
options(datatable.optimize=Inf) # yes GForce
system.time(DT[, .(.N), by=a])
# user system elapsed
# 1.620 0.675 2.306
system.time(DT[, .N, by=a])
# user system elapsed
# 1.583 0.673 2.259 |
arunsrinivasan
added a commit
that referenced
this issue
Sep 26, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: