Skip to content

GForce should kick in when i is present as well... #971

@arunsrinivasan

Description

@arunsrinivasan
require(data.table) # 1.9.5, R v3.1.2
DT = data.table(x=c(1,1,1,2,2,3,3,3), y=1:8)
options(datatable.verbose=TRUE)

# GForce kicks in
DT[, 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 'mean(y)'
# GForce optimized j to 'gmean(y)'
#    x  V1
#1: 1 2.0
#2: 2 4.5
#3: 3 7.0

# GForce doesn't
DT[x > 1L, mean(y), by=x]
# i clause present and columns used in by detected, only these subset: 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 'mean(y)'
# Old mean optimization changed j from 'mean(y)' to '.External(Cfastmean, y, FALSE)'
# Starting dogroups ... 
#   collecting discontiguous groups took 0.000s for 2 groups
#   eval(j) took 0.000s for 2 calls
# done dogroups in 0 secs
#    x  V1
#1: 2 4.5
#2: 3 7.0
  • subsets in i
  • joins in i

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions